diff options
author | Nguyễn Thái Ngọc Duy <pclouds@gmail.com> | 2017-05-03 17:16:49 +0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2017-05-26 12:33:55 +0900 |
commit | 11dc1fcb3fa53f5a46486daa7cb38ed387153f2e (patch) | |
tree | 98bf996bbac5e5c0b85ee1673a83d14a8ae0fbab /git-compat-util.h | |
parent | 8e178ec4d072da4cd8f4449e17aef3aff5b57f6a (diff) | |
download | git-11dc1fcb3fa53f5a46486daa7cb38ed387153f2e.tar.gz |
wrapper.c: add and use warn_on_fopen_errors()
In many places, Git warns about an inaccessible file after a fopen()
failed. To discern these cases from other cases where we want to warn
about inaccessible files, introduce a new helper specifically to test
whether fopen() failed because the current user lacks the permission to
open file in question.
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'git-compat-util.h')
-rw-r--r-- | git-compat-util.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/git-compat-util.h b/git-compat-util.h index 6be55cf8b3..eb5c18c7fd 100644 --- a/git-compat-util.h +++ b/git-compat-util.h @@ -1101,6 +1101,8 @@ int access_or_die(const char *path, int mode, unsigned flag); /* Warn on an inaccessible file that ought to be accessible */ void warn_on_inaccessible(const char *path); +/* Warn on an inaccessible file if errno indicates this is an error */ +int warn_on_fopen_errors(const char *path); #ifdef GMTIME_UNRELIABLE_ERRORS struct tm *git_gmtime(const time_t *); |