Module Name: src
Committed By: christos
Date: Fri Jan 1 03:18:27 UTC 2010
Modified Files:
src/sys/arch/i386/stand/bootxx: boot1.c
Log Message:
If the open fails, don't call fstat, because this changes the errno to EINVAL
from eg. ENOENT.
To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/i386/stand/bootxx/boot1.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/arch/i386/stand/bootxx/boot1.c
diff -u src/sys/arch/i386/stand/bootxx/boot1.c:1.18 src/sys/arch/i386/stand/bootxx/boot1.c:1.19
--- src/sys/arch/i386/stand/bootxx/boot1.c:1.18 Wed Nov 18 16:02:16 2009
+++ src/sys/arch/i386/stand/bootxx/boot1.c Thu Dec 31 22:18:27 2009
@@ -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