0c470f5563
Basically, it's a conflict between POSIX and ISO C what do to when input streams are passed to fflush(). POSIX mandates that the seeking-position should be synced, but ISO C says it's undefined behaviour. We love POSIX, but the standard-documents specify that in all conflict cases, ISO C wins, so this breaks with EBADF on BSD's. musl and glibc follow POSIX behaviour, which makes sense, but involves numerous portability concerns. To get around this, we just don't check fflush() and rely on the fact that no implementation sets ferror on the file-stream in fflush if it is an input stream, so every issue caught in fflush() is caught later with ferror() and fclose(). Add a comment to fshut() because this stuff is so complicated, it took us a day to figure out. |
||
---|---|---|
.. | ||
concat.c | ||
cp.c | ||
crypt.c | ||
ealloc.c | ||
enmasse.c | ||
eprintf.c | ||
eregcomp.c | ||
estrtod.c | ||
fnck.c | ||
fshut.c | ||
getlines.c | ||
human.c | ||
md5.c | ||
mode.c | ||
putword.c | ||
reallocarray.c | ||
recurse.c | ||
rm.c | ||
sha1.c | ||
sha256.c | ||
sha512.c | ||
strcasestr.c | ||
strlcat.c | ||
strlcpy.c | ||
strsep.c | ||
strtonum.c | ||
unescape.c |