diff options
author | mux <mux@FreeBSD.org> | 2002-10-30 18:19:59 +0000 |
---|---|---|
committer | mux <mux@FreeBSD.org> | 2002-10-30 18:19:59 +0000 |
commit | 75d56a025b7e6cea73266e7d9843b996a2054ace (patch) | |
tree | fc0ecbd5b5f8c9131b827c6c69f7097d1b8f659b /usr.bin | |
parent | e3a98b382a7c93a7db64f0d5e262009253d60e00 (diff) | |
download | FreeBSD-src-75d56a025b7e6cea73266e7d9843b996a2054ace.zip FreeBSD-src-75d56a025b7e6cea73266e7d9843b996a2054ace.tar.gz |
Fix core dumps when invoking with something like ``last -w1''.
PR: bin/44583
Reported by: Amit Chakradeo <sdbug@spam.chakradeo.net>
MFC after: 3 days
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/last/last.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/usr.bin/last/last.c b/usr.bin/last/last.c index 221f6db..07844a6 100644 --- a/usr.bin/last/last.c +++ b/usr.bin/last/last.c @@ -138,11 +138,10 @@ main(int argc, char *argv[]) * a number after a dash. */ if (maxrec == -1) { - p = argv[optind - 1]; - if (p[0] == '-' && p[1] == ch && !p[2]) - maxrec = atol(++p); - else - maxrec = atol(argv[optind] + 1); + p = strchr(argv[optind - 1], ch); + if (p == NULL) + p = strchr(argv[optind], ch); + maxrec = atol(p); if (!maxrec) exit(0); } |