fixed a segfault in auth/as because it didn't check to see if argv[0] and argv[1] actually had things in them

This commit is contained in:
mveety 2013-05-29 22:25:57 -04:00
parent 9abafe226e
commit a84c51a1e3

View file

@ -52,7 +52,10 @@ main(int argc, char *argv[])
initcap(); initcap();
srand(getpid()*time(0)); srand(getpid()*time(0));
runas(argv[0], argv[1]); if(argc >= 2)
runas(argv[0], argv[1]);
else
usage();
} }
void void
@ -88,7 +91,7 @@ erealloc(void *p, ulong n)
void void
usage(void) usage(void)
{ {
fprint(2, "usage: %s [-c]\n", argv0); fprint(2, "usage: %s [-c] [user] [command]\n", argv0);
exits("usage"); exits("usage");
} }