config: warn on inaccessible files
Before reading a config file, we check "!access(path, R_OK)" to make sure that the file exists and is readable. If it's not, then we silently ignore it. For the case of ENOENT, this is fine, as the presence of the file is optional. For other cases, though, it may indicate a configuration error (e.g., not having permissions to read the file). Let's print a warning in these cases to let the user know. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
889d35899b
commit
ba8bd8300a
@ -604,6 +604,9 @@ int rmdir_or_warn(const char *path);
|
||||
*/
|
||||
int remove_or_warn(unsigned int mode, const char *path);
|
||||
|
||||
/* Call access(2), but warn for any error besides ENOENT. */
|
||||
int access_or_warn(const char *path, int mode);
|
||||
|
||||
/* Get the passwd entry for the UID of the current process. */
|
||||
struct passwd *xgetpwuid_self(void);
|
||||
|
||||
|
Reference in New Issue
Block a user