Message ID | 57CF3A2D.4040707@virtuozzo.com |
---|---|
State | Rejected |
Series | "Bring some verbosity to RPC" |
Headers | show |
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)
On Wed, Sep 07, 2016 at 12:50:37AM +0300, Pavel Emelyanov wrote: > 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> Thanks. Now p.haul works again. Reviewed-by: Adrian Reber <adrian@lisas.de> > > --- > > 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)
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> ---