Module Name: src Committed By: martin Date: Tue Aug 19 13:36:04 UTC 2014
Modified Files: src/usr.sbin/sysinst: util.c Log Message: Check return values from stat before comparing contents of the result structures. Pointed out by coverity scan. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/usr.sbin/sysinst/util.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/util.c diff -u src/usr.sbin/sysinst/util.c:1.3 src/usr.sbin/sysinst/util.c:1.4 --- src/usr.sbin/sysinst/util.c:1.3 Sun Aug 10 16:44:37 2014 +++ src/usr.sbin/sysinst/util.c Tue Aug 19 13:36:04 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: util.c,v 1.3 2014/08/10 16:44:37 tls Exp $ */ +/* $NetBSD: util.c,v 1.4 2014/08/19 13:36:04 martin Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -1105,10 +1105,9 @@ get_and_unpack_sets(int update, msg setu if (!update) { struct stat sb1, sb2; - stat(target_expand("/"), &sb1); - stat(target_expand("/var"), &sb2); - - if (sb1.st_dev != sb2.st_dev) { + if (stat(target_expand("/"), &sb1) == 0 + && stat(target_expand("/var"), &sb2) == 0 + && sb1.st_dev != sb2.st_dev) { add_rc_conf("random_file=/etc/entropy-file\n"); if (target_file_exists_p("/boot.cfg")) { run_program(RUN_CHROOT|RUN_FATAL,