[PATCH 2/6] posix: Move the glob home directory lookups out of __glob

Adhemerval Zanella Netto adhemerval.zanella@linaro.org
Thu Aug 6 17:57:05 GMT 2026



On 05/08/26 22:36, Collin Funk wrote:
> Adhemerval Zanella <adhemerval.zanella@linaro.org> writes:
> 
>> Expanding "~" or "~user" needs a struct scratch_buffer to call
>> getpwnam_r through, where thecoce might reserve extra stack in
> 
> I assume you meant "the code" here?

Oops, indeed.

> 
>> +static char *
>> +glob_current_home_dir (bool *nospace)
>> +{
>> +  struct passwd *p;
>> +  struct passwd pwbuf;
>> +  struct scratch_buffer s;
>> +  char *result;
>> +  int err;
> 
> [...]
> 
>> +  result = err == 0 ? glob_dup_pw_dir (p, nospace) : NULL;
>> +  scratch_buffer_free (&s);
>> +  return result;
>> +}
> 
> A while ago in Gnulib we moved all the variable declarations to where
> they are used C99 style, since that is what we prefer for readability.
> 
> It isn't a blocker, but I think it would be a nice change for glibc as
> well, at least for new code like this.

I can change that, and I slight prefer it. It is just that we do not have
a strict guideline for glibc and for smalls functions I usually do not
pay much attention to that.

> 
> That is a minor thing I noticed and I figured was worth mentioning. The
> patch itself looks good though. I'll let you decide if you want to
> change that. Either way:
> 
> Reviewed-by: Collin Funk <collin.funk1@gmail.com>
> 
> Collin



More information about the Libc-alpha mailing list