[CRIU] [PATCH[ log: Do not BUG_ON in log_first_err

Pavel Emelyanov xemul at virtuozzo.com
Tue Sep 6 14:50:37 PDT 2016


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 <adrian at lisas.de>
Signed-off-by: Pavel Emelyanov <xemul at virtouzzo.com>

---

diff --git a/criu/log.c b/criu/log.c
index 64ce8c5..6dd8530 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)



More information about the CRIU mailing list