From: graham.gower Date: Mon, 15 Feb 2010 23:10:02 +0000 (+0000) Subject: Flush stdout, stderr before forking. From Richard Purdie. Thanks! X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=dbf9c6748a2c7eb32f7a61ea2b393d32ea334c8b;p=oweals%2Fopkg-lede.git Flush stdout, stderr before forking. From Richard Purdie. Thanks! 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 --- diff --git a/libbb/gz_open.c b/libbb/gz_open.c index 7c7c722..40f741f 100644 --- a/libbb/gz_open.c +++ b/libbb/gz_open.c @@ -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);