Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/i386/stand/bootxx If the open fails, don't call fst...



details:   https://anonhg.NetBSD.org/src/rev/6d3dad49b82d
branches:  trunk
changeset: 750450:6d3dad49b82d
user:      christos <christos%NetBSD.org@localhost>
date:      Fri Jan 01 03:18:27 2010 +0000

description:
If the open fails, don't call fstat, because this changes the errno to EINVAL
from eg. ENOENT.

diffstat:

 sys/arch/i386/stand/bootxx/boot1.c |  7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)

diffs (29 lines):

diff -r 34a2d5f52b83 -r 6d3dad49b82d sys/arch/i386/stand/bootxx/boot1.c
--- a/sys/arch/i386/stand/bootxx/boot1.c        Fri Jan 01 02:32:28 2010 +0000
+++ b/sys/arch/i386/stand/bootxx/boot1.c        Fri Jan 01 03:18:27 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: boot1.c,v 1.18 2009/11/18 21:02:16 dsl Exp $   */
+/*     $NetBSD: boot1.c,v 1.19 2010/01/01 03:18:27 christos Exp $      */
 
 /*-
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: boot1.c,v 1.18 2009/11/18 21:02:16 dsl Exp $");
+__RCSID("$NetBSD: boot1.c,v 1.19 2010/01/01 03:18:27 christos Exp $");
 
 #include <lib/libsa/stand.h>
 #include <lib/libkern/libkern.h>
@@ -107,9 +107,8 @@
 
 done:
        /* if we fail here, so will fstat, so keep going */
-       if (fstat(fd, &sb) == -1) {
+       if (fd == -1 || fstat(fd, &sb) == -1)
                return "Can't open /boot\r\n";
-       }
 
        biosdev = (uint32_t)sb.st_size;
 #if 0



Home | Main Index | Thread Index | Old Index