diff options
author | John Beppu | 1999-12-15 19:29:09 +0000 |
---|---|---|
committer | John Beppu | 1999-12-15 19:29:09 +0000 |
commit | 25ab6534576eb0dbb636867ff992ab3a69ae06bc (patch) | |
tree | e581f37fa8f12f4e756fed152294f9c3212ab5e6 /head.c | |
parent | e1618e42a8299cc928ba9af78bbea65899e76f4b (diff) | |
download | busybox-25ab6534576eb0dbb636867ff992ab3a69ae06bc.zip busybox-25ab6534576eb0dbb636867ff992ab3a69ae06bc.tar.gz |
fixed an embarrasing segfault (head w/ no args
used to die (but now it lives))
Diffstat (limited to 'head.c')
-rw-r--r-- | head.c | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -54,7 +54,7 @@ head_main(int argc, char **argv) int len = 10; /* 1st option is potentially special */ - if ((argv[1][0] == '-') && isDecimal(argv[1][1])) { + if ((argc > 1) && (argv[1][0] == '-') && isDecimal(argv[1][1])) { int tmplen = atoi(&argv[1][1]); if (tmplen) { len = tmplen; } i = 2; @@ -66,6 +66,7 @@ head_main(int argc, char **argv) opt = argv[i][1]; switch (opt) { case '-': + break; case 'h': usage(head_usage); default: @@ -103,4 +104,4 @@ head_main(int argc, char **argv) exit(0); } -/* $Id: head.c,v 1.2 1999/12/10 08:29:20 andersen Exp $ */ +/* $Id: head.c,v 1.3 1999/12/15 19:29:09 beppu Exp $ */ |