Re: BUG #8139: initdb: Misleading error message when current user not in /etc/passwd - Mailing list pgsql-bugs

From Alvaro Herrera
Subject Re: BUG #8139: initdb: Misleading error message when current user not in /etc/passwd
Date
Msg-id 20130507181904.GA26800@eldon.alvh.no-ip.org
Whole thread Raw
In response to Re: BUG #8139: initdb: Misleading error message when current user not in /etc/passwd  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: BUG #8139: initdb: Misleading error message when current user not in /etc/passwd  (Bruce Momjian <bruce@momjian.us>)
List pgsql-bugs
Tom Lane wrote:
> nicolas@marchildon.net writes:

> > The man page says:
>=20
> > RETURN VALUE
> >        The  getpwnam()  and  getpwuid() functions return a pointer to=
 a
> > passwd
> >        structure, or NULL if the matching entry  is  not  found  or  =
an=20
> > error
> >        occurs.   If an error occurs, errno is set appropriately.  If =
one
> > wants
> >        to check errno after the call, it should be  set  to  zero  be=
fore=20
> > the
> >        call.
>=20
> AFAICS, getpwuid is not honoring its specification here: it failed to
> set errno.  I don't see that suppressing the strerror result would add
> anything much.

Well, in this case no error occured, but no matching entry was found.
The wording in the manpage is explicit that there not being an entry is
not an error.

--=20
=C1lvaro Herrera                http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: BUG #8139: initdb: Misleading error message when current user not in /etc/passwd
Next
From: "Raphael"
Date:
Subject: question