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

Adrian Reber adrian at lisas.de
Wed Sep 7 01:49:28 PDT 2016


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

Thanks. Now p.haul works again.

Reviewed-by: Adrian Reber <adrian at 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)


More information about the CRIU mailing list