From 65be1371712c9159666b74553e6c85d19e35e959 Mon Sep 17 00:00:00 2001 From: Pavel Emelyanov Date: Wed, 7 Sep 2016 00:50:00 +0300 Subject: [PATCH] [PATCH[ log: Do not BUG_ON in log_first_err It turned out that calling log_first_error() is possible w/o calling log_keep_first_err(), so don't bug_on() on it, just return NULL. Reported-by: Adrian Reber Signed-off-by: Pavel Emelyanov Reviewed-by: Adrian Reber Signed-off-by: Pavel Emelyanov --- criu/log.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/criu/log.c b/criu/log.c index 64ce8c5254..6dd8530741 100644 --- a/criu/log.c +++ b/criu/log.c @@ -114,8 +114,12 @@ static void log_note_err(char *msg) char *log_first_err(void) { - BUG_ON(!first_err); - return first_err->s[0] == '\0' ? NULL : first_err->s; + if (!first_err) + return NULL; + if (first_err->s[0] == '\0') + return NULL; + + return first_err->s; } int log_init(const char *output)