From c7054209d65db430bdbcb2243288e63cea3e417c Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Tue, 30 May 2017 09:23:33 +0900 Subject: treewide: use is_missing_file_error() where ENOENT and ENOTDIR are checked Using the is_missing_file_error() helper introduced in the previous step, update all hits from $ git grep -e ENOENT --and -e ENOTDIR There are codepaths that only check ENOENT, and it is possible that some of them should be checking both. Updating them is kept out of this step deliberately, as we do not want to change behaviour in this step. Signed-off-by: Junio C Hamano --- builtin/rm.c | 2 +- builtin/update-index.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'builtin') diff --git a/builtin/rm.c b/builtin/rm.c index fb79dcab18..30c4332c68 100644 --- a/builtin/rm.c +++ b/builtin/rm.c @@ -129,7 +129,7 @@ static int check_local_mod(struct object_id *head, int index_only) ce = active_cache[pos]; if (lstat(ce->name, &st) < 0) { - if (errno != ENOENT && errno != ENOTDIR) + if (!is_missing_file_error(errno)) warning_errno(_("failed to stat '%s'"), ce->name); /* It already vanished from the working tree */ continue; diff --git a/builtin/update-index.c b/builtin/update-index.c index d530e89368..4e9402984a 100644 --- a/builtin/update-index.c +++ b/builtin/update-index.c @@ -253,7 +253,7 @@ static int remove_one_path(const char *path) */ static int process_lstat_error(const char *path, int err) { - if (err == ENOENT || err == ENOTDIR) + if (is_missing_file_error(err)) return remove_one_path(path); return error("lstat(\"%s\"): %s", path, strerror(err)); } -- cgit v1.2.3