summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorache <ache@FreeBSD.org>2006-10-16 09:57:15 +0000
committerache <ache@FreeBSD.org>2006-10-16 09:57:15 +0000
commit98e47524e910e11b4517e3a16e0001419eb09e87 (patch)
tree6955b879b51c23cbbb2c5b9d7fe52052476598e1 /lib
parent5b6b5391fa3474ffe69c4ed7f7547e19c23aef39 (diff)
downloadFreeBSD-src-98e47524e910e11b4517e3a16e0001419eb09e87.zip
FreeBSD-src-98e47524e910e11b4517e3a16e0001419eb09e87.tar.gz
Honor errno obtained from __sflags
Move errno restoring after FUNLOCKFILE in one case
Diffstat (limited to 'lib')
-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 bc2e831..70cfd60 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);
}
OpenPOWER on IntegriCloud