From e218e710f92734c23141c79e094758c92a5e5fdb Mon Sep 17 00:00:00 2001 From: Juan RP Date: Sat, 25 Jun 2011 11:47:42 +0200 Subject: [PATCH] xbps_unpack_binary_pkg: in remove_file_wrong_hash() handle ENOENT errors. --- lib/package_unpack.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/lib/package_unpack.c b/lib/package_unpack.c index cf0e9e95..dc50655a 100644 --- a/lib/package_unpack.c +++ b/lib/package_unpack.c @@ -151,10 +151,11 @@ remove_file_wrong_hash(prop_dictionary_t d, const char *file) const char *hash; int rv = 0; - if (stat(file, &st) == -1) - if (errno != ENOENT) - return errno; - + if (stat(file, &st) == -1) { + if (errno == ENOENT) + return 0; + return errno; + } if (!S_ISREG(st.st_mode)) return 0; @@ -166,6 +167,9 @@ remove_file_wrong_hash(prop_dictionary_t d, const char *file) (void)unlink(file); xbps_warn_printf("Removed `%s' entry with " "unmatched hash.\n", file); + } else if (rv == ENOENT) { + /* simply ignore */ + rv = 0; } } return rv;