diff options
author | Jeremy Kerr <jk@ozlabs.org> | 2013-05-07 15:01:53 +0800 |
---|---|---|
committer | Jeremy Kerr <jk@ozlabs.org> | 2013-05-09 08:47:54 +0800 |
commit | ad781c2aaed011dc704a018b53dcb43e5d90fd85 (patch) | |
tree | 364baa9d9e53fc394efd6d38759b1c515d6b2b2d /ui | |
parent | 038cb53fa8e19592b9c7021176fda194799f1d51 (diff) | |
download | petitboot-ad781c2aaed011dc704a018b53dcb43e5d90fd85.zip petitboot-ad781c2aaed011dc704a018b53dcb43e5d90fd85.tar.gz |
ui/nc: Don't segfault if we can't open log_file
Fallback to logging to /dev/null.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Diffstat (limited to 'ui')
-rw-r--r-- | ui/ncurses/generic-main.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/ui/ncurses/generic-main.c b/ui/ncurses/generic-main.c index 5d8debb..365034c 100644 --- a/ui/ncurses/generic-main.c +++ b/ui/ncurses/generic-main.c @@ -231,6 +231,9 @@ int main(int argc, char *argv[]) if (strcmp(opts.log_file, "-")) { FILE *log = fopen(opts.log_file, "a"); + if (!log) + log = fopen("/dev/null", "a"); + assert(log); pb_log_set_stream(log); } else |