Module Name:    src
Committed By:   martin
Date:           Tue Aug 19 13:04:45 UTC 2014

Modified Files:
        src/usr.sbin/sysinst: main.c

Log Message:
Check return value from getenv() before using the value. Pointed out by
coverity scan.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/usr.sbin/sysinst/main.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/sysinst/main.c
diff -u src/usr.sbin/sysinst/main.c:1.3 src/usr.sbin/sysinst/main.c:1.4
--- src/usr.sbin/sysinst/main.c:1.3	Wed Aug  6 09:11:46 2014
+++ src/usr.sbin/sysinst/main.c	Tue Aug 19 13:04:45 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: main.c,v 1.3 2014/08/06 09:11:46 martin Exp $	*/
+/*	$NetBSD: main.c,v 1.4 2014/08/19 13:04:45 martin Exp $	*/
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -390,7 +390,9 @@ toplevel(void)
 	 * XXX must be idempotent, since we get run each time the main
 	 *     menu is displayed.
 	 */
-	chdir(getenv("HOME"));
+	char *home = getenv("HOME");
+	if (home != NULL)
+		chdir(home);
 	unwind_mounts();
 
 	/* Display banner message in (english, francais, deutsch..) */

Reply via email to