summaryrefslogtreecommitdiff
path: root/usr.bin/nohup
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 /usr.bin/nohup
parent3602a750205b32f442e2e132baa5b3e9a3c83349 (diff)
$HOME paranoia: never use getenv("HOME") w/o checking for NULL and non-zero
Diffstat (limited to 'usr.bin/nohup')
-rw-r--r--usr.bin/nohup/nohup.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/usr.bin/nohup/nohup.c b/usr.bin/nohup/nohup.c
index 9800bec031f..99ba18d3f56 100644
--- a/usr.bin/nohup/nohup.c
+++ b/usr.bin/nohup/nohup.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: nohup.c,v 1.5 1997/12/23 03:28:14 deraadt Exp $ */
+/* $OpenBSD: nohup.c,v 1.6 2000/08/02 04:10:49 millert Exp $ */
/* $NetBSD: nohup.c,v 1.6 1995/08/31 23:35:25 jtc Exp $ */
/*
@@ -44,7 +44,7 @@ char copyright[] =
#if 0
static char sccsid[] = "@(#)nohup.c 5.4 (Berkeley) 6/1/90";
#endif
-static char rcsid[] = "$OpenBSD: nohup.c,v 1.5 1997/12/23 03:28:14 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: nohup.c,v 1.6 2000/08/02 04:10:49 millert Exp $";
#endif /* not lint */
#include <sys/param.h>
@@ -116,7 +116,7 @@ dofile()
p = FILENAME;
if ((fd = open(p, O_RDWR|O_CREAT|O_APPEND, S_IRUSR|S_IWUSR)) >= 0)
goto dupit;
- if ((p = getenv("HOME")) != NULL &&
+ if ((p = getenv("HOME")) != NULL && *p != '\0' &&
(strlen(p) + strlen(FILENAME) + 1) < sizeof(path)) {
(void)strcpy(path, p);
(void)strcat(path, "/");