From 210212143b6cbafa886e24ae6a3c1723870cb2e3 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Sun, 5 Dec 2004 18:52:33 +0000 Subject: Include . (__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. --- lib/__fpending.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/__fpending.c b/lib/__fpending.c index 007302c8c..c2405cd63 100644 --- a/lib/__fpending.c +++ b/lib/__fpending.c @@ -21,6 +21,8 @@ # include #endif +#include + #include "__fpending.h" /* Return the number of pending (aka buffered, unflushed) @@ -28,5 +30,8 @@ size_t __fpending (FILE *fp) { - return PENDING_OUTPUT_N_BYTES; + ptrdiff_t n = PENDING_OUTPUT_N_BYTES; + if (n < 0) + abort (); + return n; } -- cgit v1.2.3-54-g00ecf