diff options
author | Ted Unangst <tedu@cvs.openbsd.org> | 2003-09-26 18:58:02 +0000 |
---|---|---|
committer | Ted Unangst <tedu@cvs.openbsd.org> | 2003-09-26 18:58:02 +0000 |
commit | 8bb4fd47517f93e9fb82035dcab8904622b425ae (patch) | |
tree | 69ed51e37da9b4d5eba575faf4aed5b110703c38 /games | |
parent | 9d8d7e482288152e99012321ee4d60964a721557 (diff) |
check strdup for error. based on report from Jared Yanovich. ok deraadt@
Diffstat (limited to 'games')
-rw-r--r-- | games/battlestar/init.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/games/battlestar/init.c b/games/battlestar/init.c index 63704b5f506..588295a2d17 100644 --- a/games/battlestar/init.c +++ b/games/battlestar/init.c @@ -1,4 +1,4 @@ -/* $OpenBSD: init.c,v 1.10 2003/06/03 03:01:38 millert Exp $ */ +/* $OpenBSD: init.c,v 1.11 2003/09/26 18:58:01 tedu Exp $ */ /* $NetBSD: init.c,v 1.4 1995/03/21 15:07:35 cgd Exp $ */ /* @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)init.c 8.4 (Berkeley) 4/30/95"; #else -static char rcsid[] = "$OpenBSD: init.c,v 1.10 2003/06/03 03:01:38 millert Exp $"; +static char rcsid[] = "$OpenBSD: init.c,v 1.11 2003/09/26 18:58:01 tedu Exp $"; #endif #endif /* not lint */ @@ -57,6 +57,8 @@ initialize(filename) location = dayfile; srandomdev(); username = getutmp(); + if (username == NULL) + errx(1, "Don't know who you are."); wordinit(); if (filename == NULL) { direction = NORTH; @@ -84,7 +86,7 @@ getutmp() ptr = getpwuid(getuid()); if (ptr == NULL) - return(""); + return(NULL); else return(strdup(ptr->pw_name)); } |