On Thu, Dec 10, 2015 at 04:41:29PM -0500, Jeff King wrote: > -static struct passwd *xgetpwuid_self(void) > +static struct passwd *xgetpwuid_self(int *is_bogus) > { > struct passwd *pw; > > errno = 0; > pw = getpwuid(getuid()); > - if (!pw) > - die(_("unable to look up current user in the passwd file: %s"), > - errno ? strerror(errno) : _("no such user")); > + if (!pw) { > + struct passwd fallback; > + fallback.pw_name = "unknown"; > +#ifndef NO_GECOS_IN_PWENT > + fallback.pw_gecos = "Unknown"; > +#endif > + pw = &fallback; > + if (is_bogus) > + *is_bogus = 1; > + } > return pw; Ugh. The fallback struct should be static, of course, as we are returning its address from the function. Anybody have a brown paper bag I can borrow? diff --git a/ident.c b/ident.c index 74de079..831072c 100644 --- a/ident.c +++ b/ident.c @@ -32,7 +32,7 @@ static struct passwd *xgetpwuid_self(int *is_bogus) errno = 0; pw = getpwuid(getuid()); if (!pw) { - struct passwd fallback; + static struct passwd fallback; fallback.pw_name = "unknown"; #ifndef NO_GECOS_IN_PWENT fallback.pw_gecos = "Unknown"; -Peff -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html