Yes but other programs might like to read values left behind by rc, using
getenv

On Wed, 18 Jan 2017, 23:51 Giacomo Tesio, <[email protected]> wrote:

> Yes that would be a plausible explanation but actually rc does not use
> getenv: it reads /env/ files directly.
>
> I've tried to remove the loop and I can't see any issue.
>
>
> Giacomo
>
>
> 2017-01-18 21:13 GMT+01:00 Charles Forsyth <[email protected]>:
> > Yes, it's the lists. Nothing will cope with \0 in a C string, so it's a
> good
> > choice as list of string element separator.
> >
> > On 18 January 2017 at 19:21, Fran. J Ballesteros <[email protected]> wrote:
> >>
> >> rc lists?
> >>
> >> > El 18 ene 2017, a las 17:45, Giacomo Tesio <[email protected]>
> escribió:
> >> >
> >> > Hi, last night I noticed this strange post processing in 4th edition's
> >> > getenv:
> >> >
> https://github.com/brho/plan9/blob/master/sys/src/libc/9sys/getenv.c#L34-L41
> >> >
> >> >        seek(f, 0, 0);
> >> >        r = read(f, ans, s);
> >> >        if(r >= 0) {
> >> >            ep = ans + s - 1;
> >> >            for(p = ans; p < ep; p++)
> >> >                if(*p == '\0')
> >> >                    *p = ' ';
> >> >            ans[s] = '\0';
> >> >        }
> >> >
> >> > Anybody know why this replacement is done?
> >> > It does not seem a good fix to read/write or read/truncate races, but
> >> > I can't find a better explanation.
> >> >
> >> >
> >> > Giacomo
> >> >
> >>
> >>
> >
>
>

Reply via email to