Fix #50 (Existent files on disk might be overwritten by packages with conf_files).

This commit is contained in:
Juan RP
2014-07-30 16:18:57 +02:00
parent e92e86c2db
commit cc6f9901f1
4 changed files with 54 additions and 20 deletions

View File

@ -410,8 +410,8 @@ unpack_archive(struct xbps_handle *xhp,
"matches existing SHA256, "
"skipping...\n",
pkgver, entry_pname);
skip_extract = true;
}
skip_extract = true;
rv = 0;
}
}
@ -497,20 +497,6 @@ unpack_archive(struct xbps_handle *xhp,
"mode to %s.\n", pkgver, entry_pname,
archive_entry_strmode(entry));
}
if (!update && conf_file && file_exists && !skip_extract) {
/*
* If installing new package preserve old configuration
* file but renaming it to <file>.old.
*/
buf = xbps_xasprintf("%s.old", entry_pname);
(void)rename(entry_pname, buf);
free(buf);
buf = NULL;
xbps_set_cb_state(xhp,
XBPS_STATE_CONFIG_FILE, 0, pkgver,
"Renamed old configuration file "
"`%s' to `%s.old'.", entry_pname, entry_pname);
}
if (!force && skip_extract) {
archive_read_data_skip(ar);
continue;