Skip to content

Commit

Permalink
[PATCH[ log: Do not BUG_ON in log_first_err
Browse files Browse the repository at this point in the history
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@lisas.de>
Signed-off-by: Pavel Emelyanov <xemul@virtouzzo.com>
Reviewed-by: Adrian Reber <adrian@lisas.de>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
  • Loading branch information
xemul committed Sep 7, 2016
1 parent 26b9625 commit 65be137
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions criu/log.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 65be137

Please sign in to comment.