git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: Thomas Rast <trast@student.ethz.ch>
Cc: Junio C Hamano <gitster@pobox.com>,
	git@vger.kernel.org, Brian Gernhardt <benji@silverinsanity.com>
Subject: Re: [PATCH 2/2] check_expirations: don't copy over same element
Date: Fri, 16 Sep 2011 11:47:18 -0400	[thread overview]
Message-ID: <20110916154718.GA13740@sigill.intra.peff.net> (raw)
In-Reply-To: <29010bf6134beb20efca498e7b4f7a9d9bdb21a6.1316173346.git.trast@student.ethz.ch>

On Fri, Sep 16, 2011 at 01:51:35PM +0200, Thomas Rast wrote:

> diff --git a/credential-cache--daemon.c b/credential-cache--daemon.c
> index d6769b1..128c5ce 100644
> --- a/credential-cache--daemon.c
> +++ b/credential-cache--daemon.c
> @@ -77,7 +77,8 @@ static int check_expirations(void)
>  			free(entries[i].item.unique);
>  			free(entries[i].item.username);
>  			free(entries[i].item.password);
> -			memcpy(&entries[i], &entries[entries_nr], sizeof(*entries));
> +			if (i != entries_nr)
> +				memcpy(&entries[i], &entries[entries_nr], sizeof(*entries));

Thanks. I even remember while writing this loop considering the case of
(i == entries_nr), but decided it didn't need special-casing. But I
obviously forgot about memcpy.

Both this and the prior patch are:

Acked-by: Jeff King <peff@peff.net>

-Peff

  reply	other threads:[~2011-09-16 15:47 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-14 19:17 [PATCH 0/5] credential helper super fun pak Jeff King
2011-09-14 19:17 ` [PATCH 1/5] docs: minor tweaks to credentials API Jeff King
2011-09-14 19:17 ` [PATCH 2/5] credential-cache: fix expiration calculation corner cases Jeff King
2011-09-15  8:37   ` Thomas Rast
2011-09-16 11:51   ` [PATCH 1/2] t0300: add missing EOF terminator for << Thomas Rast
2011-09-16 11:51     ` [PATCH 2/2] check_expirations: don't copy over same element Thomas Rast
2011-09-16 15:47       ` Jeff King [this message]
2011-09-18 21:51   ` [PATCH 2/5] credential-cache: fix expiration calculation corner cases Junio C Hamano
2011-09-14 19:18 ` [PATCH 3/5] t0300: make askpass tests a little more robust Jeff King
2011-09-14 19:18 ` [PATCH 4/5] t0300: make alternate username tests " Jeff King
2011-09-14 19:21 ` [PATCH 5/5] credential-store: use a better storage format Jeff King
2011-09-14 21:37 ` [PATCH 0/5] credential helper super fun pak Junio C Hamano

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=20110916154718.GA13740@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=benji@silverinsanity.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=trast@student.ethz.ch \
    /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;
as well as URLs for NNTP newsgroup(s).