X-Git-Url: https://git.ozlabs.org/?p=petitboot;a=blobdiff_plain;f=discover%2Fpb-discover.c;h=aac50df332d4c47b636909ae7b7c0afbf3310c4a;hp=bd515e327cc9c94d75cd0c9ec3eb9de622a553ca;hb=6f381004c354e0e0e2ce5303eb7a675cd1b32c57;hpb=e93e46bfecdef5511953cd3ce1f01b0546d98af8 diff --git a/discover/pb-discover.c b/discover/pb-discover.c index bd515e3..aac50df 100644 --- a/discover/pb-discover.c +++ b/discover/pb-discover.c @@ -7,6 +7,7 @@ #include #include #include +#include #include #include @@ -58,7 +59,7 @@ static int opts_parse(struct opts *opts, int argc, char *argv[]) }; static const char short_options[] = "hl:V"; static const struct opts default_values = { - .log_file = "pb-discover.log", + .log_file = "/var/log/petitboot/pb-discover.log", }; *opts = default_values; @@ -103,7 +104,6 @@ int main(int argc, char *argv[]) struct opts opts; struct udev *udev; struct user_event *uev; - FILE *log; if (opts_parse(&opts, argc, argv)) { print_usage(); @@ -120,9 +120,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);