aboutsummaryrefslogtreecommitdiff
path: root/lib/libc/stdio
diff options
context:
space:
mode:
authorAndrey A. Chernov <ache@FreeBSD.org>2006-10-16 09:57:15 +0000
committerAndrey A. Chernov <ache@FreeBSD.org>2006-10-16 09:57:15 +0000
commit5a8d08f52be63081ae4df88c6808cafa4bca5279 (patch)
tree6955b879b51c23cbbb2c5b9d7fe52052476598e1 /lib/libc/stdio
parent6f8d08b39a31b65b09bbb99fc6531c345f7698e7 (diff)
downloadsrc-5a8d08f52be63081ae4df88c6808cafa4bca5279.tar.gz
src-5a8d08f52be63081ae4df88c6808cafa4bca5279.zip
Notes
Diffstat (limited to 'lib/libc/stdio')
-rw-r--r--lib/libc/stdio/freopen.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/libc/stdio/freopen.c b/lib/libc/stdio/freopen.c
index bc2e831e4d90..70cfd601aa3a 100644
--- a/lib/libc/stdio/freopen.c
+++ b/lib/libc/stdio/freopen.c
@@ -67,7 +67,9 @@ freopen(file, mode, fp)
int dflags, flags, isopen, oflags, sverrno, wantfd;
if ((flags = __sflags(mode, &oflags)) == 0) {
+ sverrno = errno;
(void) fclose(fp);
+ errno = sverrno;
return (NULL);
}
@@ -193,8 +195,8 @@ finish:
if (f < 0) { /* did not get it after all */
fp->_flags = 0; /* set it free */
- errno = sverrno; /* restore in case _close clobbered */
FUNLOCKFILE(fp);
+ errno = sverrno; /* restore in case _close clobbered */
return (NULL);
}