[PATCH 12/41] builtin/update-index.c: use error_errno()
- From
Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
- Date
- May 1, 2016, 11:14 UTC
- Message-ID
- <1462101297-8610-13-git-send-email-pclouds@gmail.com>
- In-Reply-To
- <1462101297-8610-1-git-send-email-pclouds@gmail.com>
"err" is deleted because it just causes confusion when "errno" is also used directly in process_lstat_error().
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> --- builtin/update-index.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/builtin/update-index.c b/builtin/update-index.c index 1c94ca5..0c539ed 100644 --- a/builtin/update-index.c +++ b/builtin/update-index.c @@ -251,11 +251,11 @@ static int remove_one_path(const char *path) * succeeds. * - permission error. That's never ok. */ -static int process_lstat_error(const char *path, int err) +static int process_lstat_error(const char *path) { - if (err == ENOENT || err == ENOTDIR) + if (errno == ENOENT || errno == ENOTDIR) return remove_one_path(path); - return error("lstat(\"%s\"): %s", path, strerror(errno)); + return error_errno("lstat(\"%s\")", path); } static int add_one_path(const struct cache_entry *old, const char *path, int len, struct stat *st) @@ -382,7 +382,7 @@ static int process_path(const char *path) * what to do about the pathname! */ if (lstat(path, &st) < 0) - return process_lstat_error(path, errno); + return process_lstat_error(path); if (S_ISDIR(st.st_mode)) return process_directory(path, len, &st);
-- 2.8.0.rc0.210.gd302cd2