Linux Container Development
 help / color / mirror / Atom feed
From: Oren Laadan <orenl-RdfvBDnrOixBDgjK7y7TUQ@public.gmane.org>
To: Matt Helsley <matthltc-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
Cc: containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org
Subject: Re: [PATCH 1/4] Fix ckpt_write_err() check for empty string
Date: Wed, 14 Oct 2009 18:32:16 -0400	[thread overview]
Message-ID: <4AD65170.30404@librato.com> (raw)
In-Reply-To: <1255481585-32625-1-git-send-email-matthltc-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>


(This is the same one you posted some time ago ...)

Pulled, thanks.

Matt Helsley wrote:
> The test for empty error strings does not work because we always add 2
> to len before testing if it's 0. Fix by checking before adding 2.
> 
> Signed-off-by: Matt Helsley <matthltc-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
> ---
>  checkpoint/checkpoint.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/checkpoint/checkpoint.c b/checkpoint/checkpoint.c
> index eaa9105..5a76d2b 100644
> --- a/checkpoint/checkpoint.c
> +++ b/checkpoint/checkpoint.c
> @@ -258,11 +258,11 @@ int ckpt_write_err(struct ckpt_ctx *ctx, char *fmt0, char *fmt, ...)
>  	}
>  
>  	str = ctx->err_string;
> -	len = strlen(str + 1) + 2;	/* leading and trailing '\0' */
> -
> +	len = strlen(str + 1);
>  	if (len == 0)	/* empty error string */
>  		return 0;
>  
> +	len += 2; 	/* leading and trailing '\0' */
>  	ret = ckpt_write_obj_type(ctx, NULL, 0, CKPT_HDR_ERROR);
>  	if (!ret)
>  		ret = ckpt_write_string(ctx, str, len);

      parent reply	other threads:[~2009-10-14 22:32 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-14  0:53 [PATCH 1/4] Fix ckpt_write_err() check for empty string Matt Helsley
     [not found] ` <1255481585-32625-1-git-send-email-matthltc-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2009-10-14 22:32   ` Oren Laadan [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4AD65170.30404@librato.com \
    --to=orenl-rdfvbdnroixbdgjk7y7tuq@public.gmane.org \
    --cc=containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org \
    --cc=matthltc-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox