mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 02:01:24 +01:00
tools/livepatch: Set stdout and stderr unbuffered
Using both stdout and stderr interleaved without newlines can result in strange output when using line buffered mode (e.g. a terminal) or when fully buffered (e.g. redirected to a file). Set stdout to unbuffered mode to fix this (stderr is always unbuffered by default). Acked-by: Wei Liu <wei.liu2@citrix.com> Acked-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> Signed-off-by: Ross Lagerwall <ross.lagerwall@citrix.com>
This commit is contained in:
1 parent
181deca063
commit
a81163ef0f
1 file changed
+6
-1
@@ -330,7 +330,6 @@ int action_func(int argc, char *argv[], unsigned int idx)
|
||||
}
|
||||
|
||||
printf(".");
|
||||
fflush(stdout);
|
||||
usleep(DELAY);
|
||||
} while ( ++retry < RETRIES );
|
||||
|
||||
@@ -416,6 +415,12 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
int i, j = 0, ret;
|
||||
|
||||
/*
|
||||
* Set stdout to be unbuffered to avoid having to fflush when
|
||||
* printing without a newline.
|
||||
*/
|
||||
setvbuf(stdout, NULL, _IONBF, 0);
|
||||
|
||||
if ( argc <= 1 )
|
||||
{
|
||||
show_help();
|
||||
|
||||