[PATCH] [PORTABILITY] don't use nonstandard __fpending in nohup

Rich Felker dalias at aerifal.cx
Fri May 19 00:56:29 UTC 2006


this patch may be controversial but it both reduces size and allows
building without using the nonstandard glibc-internal __fpending
function. i'm not sure whether the semantics are correct but EBADF
should only happen under very limited conditions.

rich

-------------- next part --------------
Index: coreutils/nohup.c
===================================================================
--- coreutils/nohup.c	(revision 15108)
+++ coreutils/nohup.c	(working copy)
@@ -9,7 +9,6 @@
 /* Written by Jim Meyering  */
 /* initial busybox port by Bernhard Fischer */
 
-#include <stdio_ext.h> /* __fpending */
 #include <stdio.h>
 #include <unistd.h>
 #include <fcntl.h>
@@ -82,7 +81,6 @@
 static void close_stdout (void)
 {
 	int prev_fail = ferror (stdout);
-	int none_pending = (0 == __fpending (stdout));
 	int fclose_fail = fclose (stdout);
 
 	if (prev_fail || fclose_fail) {
@@ -92,7 +90,7 @@
 		program like cp is invoked like this `cp a b >&-' (i.e., with
 		stdout closed) and doesn't generate any output (hence no previous
 		error and nothing to be flushed).  */
-		if ((fclose_fail ? errno : 0) == EBADF && !prev_fail && none_pending)
+		if ((fclose_fail ? errno : 0) == EBADF && !prev_fail)
 			return;
 
 		bb_perror_msg_and_die(bb_msg_write_error);


More information about the busybox mailing list