summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2004-12-05 18:52:33 +0000
committerJim Meyering <jim@meyering.net>2004-12-05 18:52:33 +0000
commit210212143b6cbafa886e24ae6a3c1723870cb2e3 (patch)
tree53d701d4806ef93a6eadfdf507e1de0945a431b9
parent821a730797c8022da2903dbf7a823acc22350c3f (diff)
downloadcoreutils-210212143b6cbafa886e24ae6a3c1723870cb2e3.tar.xz
Include <stdlib.h>.
(__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.
-rw-r--r--lib/__fpending.c7
1 files changed, 6 insertions, 1 deletions
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 <config.h>
#endif
+#include <stdlib.h>
+
#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;
}