Flush stdout, stderr before forking. From Richard Purdie. Thanks!
authorgraham.gower <graham.gower@e8e0d7a0-c8d9-11dd-a880-a1081c7ac358>
Mon, 15 Feb 2010 23:10:02 +0000 (23:10 +0000)
committergraham.gower <graham.gower@e8e0d7a0-c8d9-11dd-a880-a1081c7ac358>
Mon, 15 Feb 2010 23:10:02 +0000 (23:10 +0000)
Patch to remove "duplicate" bits of logs from opkg output, which
massively simplifies do_rootfs logs. The reason is we get unflushed
data passed to the children and duplicated.

RP - 26/1/10

git-svn-id: http://opkg.googlecode.com/svn/trunk@522 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358

libbb/gz_open.c

index 7c7c722..40f741f 100644 (file)
@@ -38,6 +38,12 @@ gz_open(FILE *compressed_file, int *pid)
                perror_msg("pipe");
                return(NULL);
        }
+
+    /* If we don't flush, we end up with two copies of anything pending, 
+       one from the parent, one from the child */
+    fflush(stdout);
+    fflush(stderr);
+
        if ((*pid = fork()) == -1) {
                perror_msg("fork");
                return(NULL);