summaryrefslogtreecommitdiff
path: root/StdLib/LibC/Stdio/freopen.c
diff options
context:
space:
mode:
Diffstat (limited to 'StdLib/LibC/Stdio/freopen.c')
-rw-r--r--StdLib/LibC/Stdio/freopen.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/StdLib/LibC/Stdio/freopen.c b/StdLib/LibC/Stdio/freopen.c
index 4d34497317..75a086b84b 100644
--- a/StdLib/LibC/Stdio/freopen.c
+++ b/StdLib/LibC/Stdio/freopen.c
@@ -104,7 +104,7 @@ freopen(const char *file, const char *mode, FILE *fp)
(void) __sflush(fp);
/* if close is NULL, closing is a no-op, hence pointless */
isopen = fp->_close != NULL;
- if ((wantfd = fp->_file) < 0 && isopen) {
+ if (((wantfd = fp->_file) >= 0) && isopen) {
(void) (*fp->_close)(fp->_cookie);
isopen = 0;
}
@@ -127,7 +127,7 @@ freopen(const char *file, const char *mode, FILE *fp)
* keep fp->_base: it may be the wrong size. This loses the effect
* of any setbuffer calls, but stdio has always done this before.
*/
- if (isopen && f != wantfd)
+ if (isopen && (f != wantfd))
(void) (*fp->_close)(fp->_cookie);
if (fp->_flags & __SMBF)
free((char *)fp->_bf._base);