Fix #20 and added an ATF test-case.

This commit is contained in:
Juan RP
2013-11-05 09:56:36 +01:00
parent 10438e58f8
commit c1fafcd339
6 changed files with 74 additions and 0 deletions

View File

@ -368,6 +368,12 @@ unpack_archive(struct xbps_handle *xhp,
conf_file = skip_extract = file_exists = false;
if (lstat(entry_pname, &st) == 0)
file_exists = true;
/*
* If file to be extracted does not match the file type of
* file currently stored on disk, remove file on disk.
*/
if (file_exists && (entry_type != (int)st.st_mode))
remove(entry_pname);
if (!force && (entry_type == AE_IFREG)) {
buf = strchr(entry_pname, '.') + 1;