Re: [PATCH 2/2] Handle invalid argc gently

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Sep 14, 2006 at 09:53:36AM -0700, Junio C Hamano wrote:
[...]
> >> What is the valid reason to do execlp("git", NULL, NULL)?
> >
> > Personally I do not plan to execute git this way on regular basis, indeed. :)
> >
> > But argc == 0 is allowed, so why should git crash?
> 
> Oh, no I was not arguing for making git crash.  I was just
> trying to learn if there is a valid reason to choose to, or
> common misconfiguration that causes it to, run with ac == 0,
> since I did not think of any.

Well, the execlp example is somewhat dragged in.
More common case is execvp:

char *argv[] = { NULL };
execvp("git", argv);

The argv array may be empty for various reasons, e.g. pointer arithmetic
mistakes.


-- 
ldv

Attachment: pgpMiw4jdoEgn.pgp
Description: PGP signature


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]