]> git.ozlabs.org Git - petitboot/blobdiff - ui/twin/main-generic.c
Log to stderr, allow --log=-
[petitboot] / ui / twin / main-generic.c
index ce6a5739e6f58351c5b47d10568cc56241537872..7cf510a44c2ebefebf485e3a6fb5f9f25bd5f158 100644 (file)
@@ -285,7 +285,6 @@ int main(int argc, char *argv[])
        static struct pbt_opts opts;
        int result;
        int ui_result;
-       FILE *log;
        struct pbt_client *client;
 
        result = pbt_opts_parse(&opts, argc, argv);
@@ -305,9 +304,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);