All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Rast <trast@student.ethz.ch>
To: "Bernhard R. Link" <brlink@debian.org>
Cc: git@vger.kernel.org, "Kevin P. Fleming" <kpfleming@digium.com>,
	"Ævar Arnfjörð Bjarmason" <avarab@gmail.com>,
	"Greg Brockman" <gdb@mit.edu>
Subject: Re: [PATCH/RFC 4/4] Add interactive mode to git-shell for user-friendliness
Date: Wed, 14 Jul 2010 17:40:37 +0200	[thread overview]
Message-ID: <201007141740.37867.trast@student.ethz.ch> (raw)
In-Reply-To: <20100714152444.GA26674@pcpool00.mathematik.uni-freiburg.de>

[Please don't trim the Cc list without good reason.]

Bernhard R. Link wrote:
> * Kevin P. Fleming <kpfleming@digium.com> [100714 15:59]:
> > On 07/14/2010 04:04 AM, Ævar Arnfjörð Bjarmason wrote:
> > > On Wed, Jul 14, 2010 at 03:01, Greg Brockman <gdb@mit.edu> wrote:
> > >> +               execl(prog, prog, (char *) NULL);
> > >
> > > Why the casting of NULL? It's not done in the builtin/help.c code.
> > >
> > > Anyway, if it was cast it should be to (const char *), shouldn't it?
> >
> > When a NULL sentinel is passed to a varargs function that only
> > understands 'char *' arguments, the NULL must be cast specifically,
> > otherwise it will appear in the varargs array as an int or a long.
> 
> To be more specific: If NULL is (void *)0 then it does not need to be
> cast. Sadly the standard allows to define it as 0, and so it is on
> some systems. So to be portable it needs to be cast to be a pointer,
> otherwise the varargs argument is assumed to be an int.

Worse, the pointer representations need not be the same between types,
even though that is a fairly exotic idea:

  http://c-faq.com/null/machexamp.html

So it seems execl() must always have an explicitly-cast (char*)NULL
sentinel.

-- 
Thomas Rast
trast@{inf,student}.ethz.ch

  reply	other threads:[~2010-07-14 15:41 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-14  3:01 [PATCH/RFC 0/4] Providing mechanism to list available repositories Greg Brockman
2010-07-14  3:01 ` [PATCH/RFC 1/4] Allow creation of arbitrary git-shell commands Greg Brockman
2010-07-14 15:27   ` Junio C Hamano
2010-07-14 17:42     ` Greg Brockman
2010-07-14  3:01 ` [PATCH/RFC 2/4] git-shell-commands: Add a command to list bare repos Greg Brockman
2010-07-14  3:01 ` [PATCH/RFC 3/4] git-shell-commands: Add a help command Greg Brockman
2010-07-14  3:01 ` [PATCH/RFC 4/4] Add interactive mode to git-shell for user-friendliness Greg Brockman
2010-07-14  9:04   ` Ævar Arnfjörð Bjarmason
2010-07-14 13:59     ` Kevin P. Fleming
2010-07-14 15:24       ` Bernhard R. Link
2010-07-14 15:40         ` Thomas Rast [this message]
     [not found]           ` <20100714160730.GA27078@pcpool00.mathematik.uni-freiburg.de>
     [not found]             ` <AANLkTikEjMeKPkyY4RdRq-ESkmmq4PvqCFPgp8yvLVBz@mail.gmail.com>
2010-07-17  4:12               ` Greg Brockman
2010-07-17  5:52                 ` Jonathan Nieder
2010-07-17 14:53                   ` Greg Brockman
2010-07-24 15:20           ` [PATCH] Cast execl*() NULL sentinels to (char *) Thomas Rast
2010-07-24 15:27             ` Ævar Arnfjörð Bjarmason
2010-07-14 10:27   ` [PATCH/RFC 4/4] Add interactive mode to git-shell for user-friendliness Johannes Sixt
2010-07-14 19:11 ` [PATCH/RFC 0/4] Providing mechanism to list available repositories Junio C Hamano
2010-07-14 19:29   ` Greg Brockman

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=201007141740.37867.trast@student.ethz.ch \
    --to=trast@student.ethz.ch \
    --cc=avarab@gmail.com \
    --cc=brlink@debian.org \
    --cc=gdb@mit.edu \
    --cc=git@vger.kernel.org \
    --cc=kpfleming@digium.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.