aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2015-10-14 21:56:57 +0200
committerMattias Andrée <maandree@operamail.com>2015-10-14 21:56:57 +0200
commit1f6b4efc877b46a7ccb1514cacb3ffffb58e28a5 (patch)
treeef0ac34e5d335fb83e13e4466593037bd0280e1f
parentlinux guarantees that a call to clock will always close the file descriptor if valid (diff)
downloadmongoclock-1f6b4efc877b46a7ccb1514cacb3ffffb58e28a5.tar.gz
mongoclock-1f6b4efc877b46a7ccb1514cacb3ffffb58e28a5.tar.bz2
mongoclock-1f6b4efc877b46a7ccb1514cacb3ffffb58e28a5.tar.xz
argc can be 0, do not crash on error if it is
Signed-off-by: Mattias Andrée <maandree@operamail.com>
-rw-r--r--src/mongoclock.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/mongoclock.c b/src/mongoclock.c
index 3170c95..96244b6 100644
--- a/src/mongoclock.c
+++ b/src/mongoclock.c
@@ -298,12 +298,11 @@ int main(int argc, char* argv[])
return 0;
fail:
- perror(*argv);
+ perror(argc ? *argv : "mongoclock");
fprintf(stdout, "\033[?25h\n\033[?1049l");
fflush(stdout);
if (fd >= 0)
close(fd);
return 1;
- (void) argc;
}