[Patch] Make getenv() functional before the environment is initialized

Christopher Faylor cgf-no-personal-reply-please@cygwin.com
Mon Apr 24 16:43:00 GMT 2006


On Mon, Apr 24, 2006 at 12:35:59PM -0400, Christopher Faylor wrote:
>I get a "it works" when I do this.
>
>#include <stdio.h>
>
>int
>main (int argc, char **argv)
>{
>  if (*argv[0] == 'f')
>    puts ("it works");
>}

But, in keeping with my previously noticed propensity for gaining
intelligence five seconds after hitting 'y', it occurred to me that my
test case was flawed.  Changing the above 'if' so that it did this:

  if (*argv[1] == 'o')

resulted in a SEGV.  So I got the precedence of '*' wrong.  I've checked
in a patch to deal with this problem.

cgf



More information about the Cygwin-patches mailing list