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

Collin Funk <[email protected]> Wed, 05 Aug 2026 18:36:04 -0700
Newsgroups gmane.comp.lib.glibc.alpha
Message-ID <[email protected]>
Adhemerval Zanella <[email protected]> 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?

> +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.

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 <[email protected]>

Collin