Re: [PATCH v2] ident: check /etc/mailname if email is unknown
- From
- Ian Jackson <ijackson@chiark.greenend.org.uk>
- Date
- Oct 3, 2011, 11:32 UTC
- Message-ID
- <20105.40257.351258.425389@chiark.greenend.org.uk>
- In-Reply-To
- <4E895FBD.8020904@viscovery.net>
Johannes Sixt writes ("Re: [PATCH v2] ident: check /etc/mailname if email is unknown"):Show 12 quoted lines
> Am 10/3/2011 8:16, schrieb Jonathan Nieder:
> > +static int add_mailname_host(char *buf, size_t len)
> > +{
> > + FILE *mailname;
> > +
> > + mailname = fopen("/etc/mailname", "r");
> > + if (!mailname) {
> > + if (errno != ENOENT)
> > + warning("cannot open /etc/mailname: %s",
> > + strerror(errno));
>
> This warns on EACCES. Is that OK? (Just asking, I have no opinion.)I think that's correct. Personally I'm a bit of an error handling fascist and I would have it crash on EACCES but that's probably a bit harsh.
Certainly this file ought to be generally readable, if it exists.
Ian.