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 values from stat before compar...
details: https://anonhg.NetBSD.org/src/rev/80369b68ebb2
branches: trunk
changeset: 331686:80369b68ebb2
user: martin <martin%NetBSD.org@localhost>
date: Tue Aug 19 13:36:04 2014 +0000
description:
Check return values from stat before comparing contents of the result
structures. Pointed out by coverity scan.
diffstat:
usr.sbin/sysinst/util.c | 9 ++++-----
1 files changed, 4 insertions(+), 5 deletions(-)
diffs (23 lines):
diff -r b0c031c27732 -r 80369b68ebb2 usr.sbin/sysinst/util.c
--- a/usr.sbin/sysinst/util.c Tue Aug 19 13:30:32 2014 +0000
+++ b/usr.sbin/sysinst/util.c Tue Aug 19 13:36:04 2014 +0000
@@ -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 @@
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,
Home |
Main Index |
Thread Index |
Old Index