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; const char *hash;
int rv = 0; int rv = 0;
if (stat(file, &st) == -1) if (stat(file, &st) == -1) {
if (errno != ENOENT) if (errno == ENOENT)
return 0;
return errno; return errno;
}
if (!S_ISREG(st.st_mode)) if (!S_ISREG(st.st_mode))
return 0; return 0;
@ -166,6 +167,9 @@ remove_file_wrong_hash(prop_dictionary_t d, const char *file)
(void)unlink(file); (void)unlink(file);
xbps_warn_printf("Removed `%s' entry with " xbps_warn_printf("Removed `%s' entry with "
"unmatched hash.\n", file); "unmatched hash.\n", file);
} else if (rv == ENOENT) {
/* simply ignore */
rv = 0;
} }
} }
return rv; return rv;