#include <getopt.h>
#include <stdlib.h>
#include <signal.h>
+#include <string.h>
#include <waiter/waiter.h>
#include <log/log.h>
};
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;
struct opts opts;
struct udev *udev;
struct user_event *uev;
- FILE *log;
if (opts_parse(&opts, argc, argv)) {
print_usage();
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);