summaryrefslogtreecommitdiffstats
path: root/ui/twin/main-generic.c
diff options
context:
space:
mode:
authorGeoff Levand <geoff@infradead.org>2012-03-26 19:23:17 -0700
committerGeoff Levand <geoff@infradead.org>2012-03-26 19:23:17 -0700
commit09cc1ef3d7e2c1dab6648aceb24dd33e7897f998 (patch)
treec270bc7b9f5bf0962f87a1681ef8924f10a0e751 /ui/twin/main-generic.c
parentdbb6ce1119c8fc1f30bb18062b5ab3d6260bb0b1 (diff)
downloadtalos-petitboot-09cc1ef3d7e2c1dab6648aceb24dd33e7897f998.tar.gz
talos-petitboot-09cc1ef3d7e2c1dab6648aceb24dd33e7897f998.zip
Log to stderr, allow --log=-
Signed-off-by: Geoff Levand <geoff@infradead.org>
Diffstat (limited to 'ui/twin/main-generic.c')
-rw-r--r--ui/twin/main-generic.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/ui/twin/main-generic.c b/ui/twin/main-generic.c
index ce6a573..7cf510a 100644
--- a/ui/twin/main-generic.c
+++ b/ui/twin/main-generic.c
@@ -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);
OpenPOWER on IntegriCloud