From ab91bd09317725a62807d110d01d101caec415ea Mon Sep 17 00:00:00 2001 From: Aggelos Economopoulos Date: Tue, 25 May 2010 01:15:50 +0300 Subject: [PATCH] evtranalyze: don't try to open stdin by default We don't handle that correctly yet, so error out instead. A lot of people were getting a crash on their first run b/c they didn't specify an input file. --- usr.bin/evtranalyze/evtranalyze.c | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-) diff --git a/usr.bin/evtranalyze/evtranalyze.c b/usr.bin/evtranalyze/evtranalyze.c index 59d7b2c..5666ebc 100644 --- a/usr.bin/evtranalyze/evtranalyze.c +++ b/usr.bin/evtranalyze/evtranalyze.c @@ -88,7 +88,7 @@ struct command { }; evtr_t evtr; -char *opt_infile; +static char *opt_infile; unsigned evtranalyze_debug; static @@ -953,7 +953,9 @@ main(int argc, char **argv) if (argc == 0) { err(2, "need to specify a command\n"); } - if (!opt_infile || !strcmp(opt_infile, "-")) { + if (!opt_infile) { + err(2, "you need to specify an input file\n"); + } else if (!strcmp(opt_infile, "-")) { inf = stdin; } else { inf = fopen(opt_infile, "r"); -- 1.7.7.2