Re: [PATCH v4 05/10] run-command: prepare child environment before forking
- From
- Brandon Williams <bmwill@google.com>
- Date
- Apr 18, 2017, 21:02 UTC
- Message-ID
- <20170418210250.GA10227@google.com>
- In-Reply-To
- <20170418002651.GA14303@dcvr.yhbt.net>
On 04/18, Eric Wong wrote:
Show 10 quoted lines
> > +static int env_isequal(const char *e1, const char *e2)
> > +{
> > + for (;;) {
> > + char c1 = *e1++;
> > + char c2 = *e2++;
> > + c1 = (c1 == '=') ? '\0' : tolower(c1);
> > + c2 = (c2 == '=') ? '\0' : tolower(c2);
>
> Dealing with C strings scares me so maybe I'm misreading;
> but: why is this comparison case-insensitive?Well i was pulling inspiration from the stuff in mingw.c...looks like i probably shouldn't have done so as you're correct, they should be case-sensitive. Jonathan pointed out that doing this env stuff in vanilla C may not be a good idea...and I kinda forgot about that cause it worked (it passed tests) Let me re-write this section of code to make it correct, and saner.
-- Brandon Williams