Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/lib/libc/stdio make sure we preserve errno.
details: https://anonhg.NetBSD.org/src/rev/0a1d61e385ed
branches: trunk
changeset: 499793:0a1d61e385ed
user: christos <christos%NetBSD.org@localhost>
date: Wed Nov 29 15:30:20 2000 +0000
description:
make sure we preserve errno.
diffstat:
lib/libc/stdio/fopen.c | 10 ++++++----
1 files changed, 6 insertions(+), 4 deletions(-)
diffs (35 lines):
diff -r 3e2acdc5f5e6 -r 0a1d61e385ed lib/libc/stdio/fopen.c
--- a/lib/libc/stdio/fopen.c Wed Nov 29 15:29:51 2000 +0000
+++ b/lib/libc/stdio/fopen.c Wed Nov 29 15:30:20 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: fopen.c,v 1.9 2000/01/15 01:11:45 christos Exp $ */
+/* $NetBSD: fopen.c,v 1.10 2000/11/29 15:30:20 christos Exp $ */
/*-
* Copyright (c) 1990, 1993
@@ -41,7 +41,7 @@
#if 0
static char sccsid[] = "@(#)fopen.c 8.1 (Berkeley) 6/4/93";
#else
-__RCSID("$NetBSD: fopen.c,v 1.9 2000/01/15 01:11:45 christos Exp $");
+__RCSID("$NetBSD: fopen.c,v 1.10 2000/11/29 15:30:20 christos Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
@@ -73,12 +73,14 @@
if (oflags & O_NONBLOCK) {
struct stat st;
if (fstat(f, &st) == -1) {
- close(f);
+ int sverrno = errno;
+ (void)close(f);
+ errno = sverrno;
goto release;
}
if (!S_ISREG(st.st_mode)) {
+ (void)close(f);
errno = EFTYPE;
- close(f);
goto release;
}
}
Home |
Main Index |
Thread Index |
Old Index