diff options
author | Maxime Henrion <mux@FreeBSD.org> | 2002-10-30 18:19:59 +0000 |
---|---|---|
committer | Maxime Henrion <mux@FreeBSD.org> | 2002-10-30 18:19:59 +0000 |
commit | 4fd036fdbecf458ef9e5c552f1b3bc887be7951c (patch) | |
tree | fc0ecbd5b5f8c9131b827c6c69f7097d1b8f659b /usr.bin/last/last.c | |
parent | 1979061b56e339740866ec9899b8f043c7dd98d3 (diff) | |
download | src-4fd036fdbecf458ef9e5c552f1b3bc887be7951c.tar.gz src-4fd036fdbecf458ef9e5c552f1b3bc887be7951c.zip |
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
Notes
Notes:
svn path=/head/; revision=106215
Diffstat (limited to 'usr.bin/last/last.c')
-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 221f6db63095..07844a67055e 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); } |