summaryrefslogtreecommitdiff
path: root/games/larn/main.c
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2000-08-02 04:10:51 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2000-08-02 04:10:51 +0000
commiteb9184a174a8fb2f98f2f1418f87863716a5c115 (patch)
tree02b606fefe2b41782be054be7fdd586e53befba0 /games/larn/main.c
parent3602a750205b32f442e2e132baa5b3e9a3c83349 (diff)
$HOME paranoia: never use getenv("HOME") w/o checking for NULL and non-zero
Diffstat (limited to 'games/larn/main.c')
-rw-r--r--games/larn/main.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/games/larn/main.c b/games/larn/main.c
index b9c2fe007d7..47b52de276c 100644
--- a/games/larn/main.c
+++ b/games/larn/main.c
@@ -1,9 +1,9 @@
-/* $OpenBSD: main.c,v 1.10 2000/06/29 07:55:42 pjanzen Exp $ */
+/* $OpenBSD: main.c,v 1.11 2000/08/02 04:10:45 millert Exp $ */
/* $NetBSD: main.c,v 1.12 1998/02/12 08:07:49 mikel Exp $ */
/* main.c */
#ifndef lint
-static char rcsid[] = "$OpenBSD: main.c,v 1.10 2000/06/29 07:55:42 pjanzen Exp $";
+static char rcsid[] = "$OpenBSD: main.c,v 1.11 2000/08/02 04:10:45 millert Exp $";
#endif /* not lint */
#include <sys/types.h>
@@ -90,8 +90,10 @@ main(argc, argv)
strlcpy(loginname, ptr, LOGIN_NAME_MAX);
/* this will be overwritten with the player's name */
strlcpy(logname, ptr, LOGNAMESIZE);
- if ((ptr = getenv("HOME")) == NULL)
- ptr = ".";
+ if ((ptr = getenv("HOME")) == NULL) {
+ fprintf(stderr, "You have no home directory!\n");
+ exit(1);
+ }
if (strlen(ptr) + 9 < sizeof(savefilename)) {
strcpy(savefilename, ptr);
strcat(savefilename, "/Larn.sav"); /* save file name in