(__fpending): Abort if PENDING_OUTPUT_N_BYTES is negative.
This ensures that if there is an error in the definition of the
PENDING_OUTPUT_N_BYTES expression, we'll find about it right away;
this value is used only in the rare event that close_stdout's
fclose fails with EBADF.
# include <config.h>
#endif
+#include <stdlib.h>
+
#include "__fpending.h"
/* Return the number of pending (aka buffered, unflushed)
size_t
__fpending (FILE *fp)
{
- return PENDING_OUTPUT_N_BYTES;
+ ptrdiff_t n = PENDING_OUTPUT_N_BYTES;
+ if (n < 0)
+ abort ();
+ return n;
}