From: Rich Felker Date: Mon, 2 May 2011 13:18:03 +0000 (-0400) Subject: fix fclose return status logic, again X-Git-Tag: v0.7.10~10 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=78c808b1264cbbec6c7cf4e9c4f321736a218949;p=oweals%2Fmusl.git fix fclose return status logic, again the previous fix was incorrect, as it would prevent f->close(f) from being called if fflush(f) failed. i believe this was the original motivation for using | rather than ||. so now let's just use a second statement to constrain the order of function calls, and to back to using |. --- diff --git a/src/stdio/fclose.c b/src/stdio/fclose.c index 9481470d..ee772fbb 100644 --- a/src/stdio/fclose.c +++ b/src/stdio/fclose.c @@ -13,7 +13,8 @@ int fclose(FILE *f) OFLUNLOCK(); } - r = -(fflush(f) || f->close(f)); + r = fflush(f); + r |= f->close(f); if (!perm) free(f);