[PROBLEM] "findmnt --poll" does not flush stdout causing it to buffer the output more than it should when the output is to a pipe or file.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



"findmnt --poll" does not flush stdout causing it to buffer the
output more than it should when the output is to a pipe or file.

This issue can be observed by comparing the output of:
	findmnt --poll --pairs
with the output of:
	findmnt --poll --pairs | tee /tmp/output.log
when these two command are run at the same time
and some filesystems are (un)(re)mounted.

Redirecting the output to a file:
	findmnt --poll --pairs > /tmp/output.log
or executing findmnt with ssh:
	ssh user@server findmnt --poll --pairs
also show the same symptom.

The attached patch simply adds a "fflush(stdout);" after the
output is printed.

Thanks

p.s. I'm not certain if this is the proper place and way to
report this issue. If this should go somewhere else, please
point me in the right direction.
diff --git a/misc-utils/findmnt.c b/misc-utils/findmnt.c
index aff2847..3984d44 100644
--- a/misc-utils/findmnt.c
+++ b/misc-utils/findmnt.c
@@ -1142,6 +1142,7 @@ static int poll_table(struct libmnt_table *tb, const char *tabfile,

 		if (count) {
 			rc = scols_table_print_range(table, NULL, NULL);
+			fflush(stdout);
 			if (rc)
 				goto done;
 		}

Attachment: signature.asc
Description: This is a digitally signed message part.


[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux