All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alan Jenkins <alan.christopher.jenkins@gmail.com>
To: selinux@tycho.nsa.gov
Cc: Alan Jenkins <alan.christopher.jenkins@gmail.com>
Subject: [PATCH 2/3] policycoreutils/setfiles: don't scramble stdout and stderr together
Date: Sun, 26 Mar 2017 17:22:44 +0100	[thread overview]
Message-ID: <20170326162245.21135-2-alan.christopher.jenkins@gmail.com> (raw)
In-Reply-To: <20170326162245.21135-1-alan.christopher.jenkins@gmail.com>

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@gmail.com>
---
 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

  reply	other threads:[~2017-03-26 16:23 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-26 16:22 [PATCH 1/3] policycoreutils/setfiles: stdout messages don't need program prefix Alan Jenkins
2017-03-26 16:22 ` Alan Jenkins [this message]
2017-03-26 16:22 ` [PATCH 3/3] policycoreutils: fixfiles: remove useless use of cat Alan Jenkins
2017-03-28 19:56 ` [PATCH 1/3] policycoreutils/setfiles: stdout messages don't need program prefix James Carter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170326162245.21135-2-alan.christopher.jenkins@gmail.com \
    --to=alan.christopher.jenkins@gmail.com \
    --cc=selinux@tycho.nsa.gov \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.