(void) __sflush(fp);\r
/* if close is NULL, closing is a no-op, hence pointless */\r
isopen = fp->_close != NULL;\r
- if ((wantfd = fp->_file) < 0 && isopen) {\r
+ if (((wantfd = fp->_file) >= 0) && isopen) {\r
(void) (*fp->_close)(fp->_cookie);\r
isopen = 0;\r
}\r
* keep fp->_base: it may be the wrong size. This loses the effect\r
* of any setbuffer calls, but stdio has always done this before.\r
*/\r
- if (isopen && f != wantfd)\r
+ if (isopen && (f != wantfd))\r
(void) (*fp->_close)(fp->_cookie);\r
if (fp->_flags & __SMBF)\r
free((char *)fp->_bf._base);\r