git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Stefan Beller <sbeller@google.com>
To: Jeff King <peff@peff.net>
Cc: Junio C Hamano <gitster@pobox.com>,
	"git@vger.kernel.org" <git@vger.kernel.org>
Subject: Re: [PATCH] submodule_init: die cleanly on submodules without url defined
Date: Tue, 25 Apr 2017 08:52:48 -0700	[thread overview]
Message-ID: <CAGZ79kb9hsvrzc=RnhhyJf-tTnr9rTfV-TQWimYFGwU_Kuew9w@mail.gmail.com> (raw)
In-Reply-To: <20170425005746.tulvexabonlexah3@sigill.intra.peff.net>

On Mon, Apr 24, 2017 at 5:57 PM, Jeff King <peff@peff.net> wrote:
> When we init a submodule, we try to die when it has no URL
> defined:
>
>   url = xstrdup(sub->url);
>   if (!url)
>           die(...);
>
> But that's clearly nonsense. xstrdup() will never return
> NULL, and if sub->url is NULL, we'll segfault.
>
> These two bits of code need to be flipped, so we check
> sub->url before looking at it.
>
> Signed-off-by: Jeff King <peff@peff.net>
> ---

Makes sense. At the time I assumed xstrdup had a _or_null
behavior (i.e. if NULL goes in, it is not duplicated, but rather
return NULL)

Thanks,
Stefan

      reply	other threads:[~2017-04-25 15:54 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-25  0:57 [PATCH] submodule_init: die cleanly on submodules without url defined Jeff King
2017-04-25 15:52 ` Stefan Beller [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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to='CAGZ79kb9hsvrzc=RnhhyJf-tTnr9rTfV-TQWimYFGwU_Kuew9w@mail.gmail.com' \
    --to=sbeller@google.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=peff@peff.net \
    /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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).