Thread (1 message) 1 message, 1 author, 2016-06-15

Re: [PATCH v2] ident: check /etc/mailname if email is unknown

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:52:10

Ian Jackson [off-list ref] writes:
quoted
quoted
+	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.
It is not just harsh but is outright wrong if the platform is not Debian
and the platform happens to use the file for other purposes that does not
require normal users to be able to read the file.

It _might_ make sense to do

        #ifndef DEBIAN
        #define add_mailname_host(x,y) (-1)
        #else
        static int add_mailname_host(char *buf, size_t len)
        {
                ...
        }
        #endif
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help