[CRIU] [PATCH 18/20] compel: print errors to stderr
Kir Kolyshkin
kir at openvz.org
Thu Dec 8 01:44:31 PST 2016
After seeing a bunch of silent build failures, like this:
> GEN criu/pie/parasite-native-blob.h
> criu/pie/Makefile:121: recipe for target 'criu/pie/parasite-native-blob.h' failed
I finally took a look at why are they silent, only to discover that
compel prints errors to stdout, and of course its stdout is silenced
in criu/pie/Makefile (unless you run make with V=1, in which case
it prints tons and tons of very useful information). I am so shocked
by this evil plan!
Anyway, let's print errors to stderr like all sane programs do.
Signed-off-by: Kir Kolyshkin <kir at openvz.org>
---
compel/src/main.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/compel/src/main.c b/compel/src/main.c
index b75c040..a26b2e1 100644
--- a/compel/src/main.c
+++ b/compel/src/main.c
@@ -106,8 +106,15 @@ err:
static void cli_log(unsigned int lvl, const char *fmt, va_list parms)
{
- if (!pr_quelled(lvl))
- vprintf(fmt, parms);
+ FILE *f = stdout;
+
+ if (pr_quelled(lvl))
+ return;
+
+ if ((lvl == LOG_ERROR) || (lvl == LOG_WARN))
+ f = stderr;
+
+ vfprintf(f, fmt, parms);
}
static int usage(int rc) {
--
2.7.4
More information about the CRIU
mailing list