Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.sbin/sysinst Check return value from getenv() before usi...



details:   https://anonhg.NetBSD.org/src/rev/3e3f6c7f142c
branches:  trunk
changeset: 331683:3e3f6c7f142c
user:      martin <martin%NetBSD.org@localhost>
date:      Tue Aug 19 13:04:45 2014 +0000

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

diffstat:

 usr.sbin/sysinst/main.c |  6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diffs (20 lines):

diff -r b2fdfbbcf76d -r 3e3f6c7f142c usr.sbin/sysinst/main.c
--- a/usr.sbin/sysinst/main.c   Tue Aug 19 13:01:48 2014 +0000
+++ b/usr.sbin/sysinst/main.c   Tue Aug 19 13:04:45 2014 +0000
@@ -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 @@
         * 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..) */



Home | Main Index | Thread Index | Old Index