[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH v2 2/8] tools/livepatch: Set stdout and stderr unbuffered
On Wed, Dec 14, 2016 at 07:51:54AM +0000, Ross Lagerwall wrote: > 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). > > Signed-off-by: Ross Lagerwall <ross.lagerwall@xxxxxxxxxx> Acked-by: Wei Liu <wei.liu2@xxxxxxxxxx> > --- > tools/misc/xen-livepatch.c | 7 ++++++- > 1 file changed, 6 insertions(+), 1 deletion(-) > > diff --git a/tools/misc/xen-livepatch.c b/tools/misc/xen-livepatch.c > index f6c7c8a..56ae5aa 100644 > --- a/tools/misc/xen-livepatch.c > +++ b/tools/misc/xen-livepatch.c > @@ -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(); > -- > 2.7.4 > _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx https://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |