[PATCH 2/3] policycoreutils/setfiles: don't scramble stdout and stderr together

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

 



https://bugzilla.redhat.com/show_bug.cgi?id=1435894

When output to a non-tty (as caused by the implementation of fixfiles),
stdout is fully buffered.  stdout should be flushed before writes to
stderr.

See e.g. https://news.ycombinator.com/item?id=1271015

Signed-off-by: Alan Jenkins <alan.christopher.jenkins@xxxxxxxxx>
---
 policycoreutils/setfiles/setfiles.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/policycoreutils/setfiles/setfiles.c b/policycoreutils/setfiles/setfiles.c
index 83e0b2a..bc83c27 100644
--- a/policycoreutils/setfiles/setfiles.c
+++ b/policycoreutils/setfiles/setfiles.c
@@ -149,6 +149,7 @@ log_callback(int type, const char *fmt, ...)
 		out = stdout;
 	} else {
 		out = stderr;
+		fflush(stdout);
 		fprintf(out, "%s: ", r_opts.progname);
 	}
 	va_start(ap, fmt);
-- 
2.9.3

_______________________________________________
Selinux mailing list
Selinux@xxxxxxxxxxxxx
To unsubscribe, send email to Selinux-leave@xxxxxxxxxxxxx.
To get help, send an email containing "help" to Selinux-request@xxxxxxxxxxxxx.



[Index of Archives]     [Selinux Refpolicy]     [Linux SGX]     [Fedora Users]     [Fedora Desktop]     [Yosemite Photos]     [Yosemite Camping]     [Yosemite Campsites]     [KDE Users]     [Gnome Users]

  Powered by Linux