From d7ce700605e1af0e455e31ec11f19ff21d26b525 Mon Sep 17 00:00:00 2001 From: darylm503 Date: Sat, 30 Jul 2011 00:30:44 +0000 Subject: Add Socket Libraries. Add Posix functions for porting compatibility. Fix compliance issues with ISO/IEC 9899:199409 New Functions: setenv(), fparseln(), GetFileNameFromPath(), rename(), realpath(), setprogname(), getprogname(), strlcat(), strlcpy(), strsep(), setitimer(), getitimer(), timegm(), getopt(), basename(), mkstemp(), ffs(), vsnprintf(), snprintf(), getpass(), usleep(), select(), writev(), strcasecmp(), getcwd(), chdir(), tcgetpgrp(), getpgrp(), gettimeofday(), bcopy(), git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12061 6f19259b-4bc3-4df7-8a09-765794883524 --- StdLib/LibC/Stdio/freopen.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'StdLib/LibC/Stdio/freopen.c') 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); -- cgit v1.2.3