xbps_unpack_binary_pkg: in remove_file_wrong_hash() handle ENOENT errors.

This commit is contained in:
Juan RP 2011-06-25 11:47:42 +02:00
parent cf4b9b5011
commit e218e710f9

View File

@ -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;