summaryrefslogtreecommitdiffstats
path: root/lib/libc
diff options
context:
space:
mode:
authorpfg <pfg@FreeBSD.org>2016-03-30 01:32:08 +0000
committerpfg <pfg@FreeBSD.org>2016-03-30 01:32:08 +0000
commitdd505c7bdadb032f6e8d5b063b17b0044d3c1983 (patch)
tree8ae639a92ad237862df28c08abaf3f2d28af1b22 /lib/libc
parent0254414aa559520f3865dca5dd97f19c5cc6a245 (diff)
downloadFreeBSD-src-dd505c7bdadb032f6e8d5b063b17b0044d3c1983.zip
FreeBSD-src-dd505c7bdadb032f6e8d5b063b17b0044d3c1983.tar.gz
freopen(3): prevent uninitialized errno.
The case doesn't look very likely but clean the possibility nevertheless CID: 1018720 MFC after: 1 week
Diffstat (limited to 'lib/libc')
-rw-r--r--lib/libc/stdio/freopen.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/libc/stdio/freopen.c b/lib/libc/stdio/freopen.c
index e0104c8..13c19a7 100644
--- a/lib/libc/stdio/freopen.c
+++ b/lib/libc/stdio/freopen.c
@@ -66,7 +66,8 @@ freopen(const char * __restrict file, const char * __restrict mode,
(void) fclose(fp);
errno = sverrno;
return (NULL);
- }
+ } else
+ sverrno = 0;
FLOCKFILE(fp);
OpenPOWER on IntegriCloud