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
This commit is contained in:
Maxime Henrion 2002-10-30 18:19:59 +00:00
parent 1979061b56
commit 4fd036fdbe
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=106215

View File

@ -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);
}