]> git.ozlabs.org Git - petitboot/blobdiff - ui/ncurses/ps3-main.c
nc: Only expand debug macros if DEBUG is defined
[petitboot] / ui / ncurses / ps3-main.c
index d9a66fad74a94ca140d0a916452f5063c61ef0e5..26d2591d467f7112fa63b7f351dde76f8d4224ba 100644 (file)
@@ -90,7 +90,7 @@ static int opts_parse(struct opts *opts, int argc, char *argv[])
        };
        static const char short_options[] = "hl:trV";
        static const struct opts default_values = {
-               .log_file = "pb-cui.log",
+               .log_file = "/var/log/petitboot/petitboot-nc.log",
        };
 
        *opts = default_values;
@@ -307,7 +307,7 @@ static int ps3_kexec_cb(struct cui *cui, struct cui_opt_data *cod)
        } else
                altered_args = 0;
 
-       result = pb_run_kexec(cod->kd);
+       result = pb_run_kexec(cod->kd, ps3->cui->dry_run);
 
        if (altered_args) {
                talloc_free(cod->kd->args);
@@ -597,7 +597,6 @@ int main(int argc, char *argv[])
        int result;
        int cui_result;
        unsigned int mode;
-       FILE *log;
 
        result = opts_parse(&opts, argc, argv);
 
@@ -616,9 +615,13 @@ int main(int argc, char *argv[])
                return EXIT_SUCCESS;
        }
 
-       log = fopen(opts.log_file, "a");
-       assert(log);
-       pb_log_set_stream(log);
+       if (strcmp(opts.log_file, "-")) {
+               FILE *log = fopen(opts.log_file, "a");
+
+               assert(log);
+               pb_log_set_stream(log);
+       } else
+               pb_log_set_stream(stderr);
 
 #if defined(DEBUG)
        pb_log_always_flush(1);