diff options
author | Dan McGee <dan@archlinux.org> | 2011-07-16 10:07:25 -0500 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2011-07-18 10:34:05 -0500 |
commit | 1c39e4fbade29d570858ca6eca4958ab72cfbdd0 (patch) | |
tree | 94778d2fed75db5d8bad3122779fdc1b95c18423 /lib/libalpm/util.h | |
parent | 3a04267cdd0b1324c8153c813e9bc5726b005670 (diff) | |
download | pacman-1c39e4fbade29d570858ca6eca4958ab72cfbdd0.tar.xz |
Handle removal of empty directories properly
This addresses FS#25141. We shouldn't remove every empty directory we
come across during the removal process unless it is truly not known to
any other package. This will prevent removal of essential directories
such as '/var/lock/'.
This is accomplished by first checking the empty/non-empty status of a
directory, which was previously done implicitly by calling rmdir() and
ignoring errors. We do this to avoid the next (new) check in most cases,
which is to look at all local packages to see if the to-be-removed
directory is present in another packages' filelist. If we do not find it
anywhere, then we remove it, else we keep the file around.
The pactest has been updated to test more cases, as well as finding a
flaw in the original expected to fail case- we need separate DIR and
FILE based EXIST rules.
Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'lib/libalpm/util.h')
-rw-r--r-- | lib/libalpm/util.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/libalpm/util.h b/lib/libalpm/util.h index 450dac9b..d66ddee9 100644 --- a/lib/libalpm/util.h +++ b/lib/libalpm/util.h @@ -100,6 +100,7 @@ int _alpm_unpack_single(alpm_handle_t *handle, const char *archive, int _alpm_unpack(alpm_handle_t *handle, const char *archive, const char *prefix, alpm_list_t *list, int breakfirst); int _alpm_rmrf(const char *path); +ssize_t _alpm_files_in_directory(alpm_handle_t *handle, const char *path, int full_count); int _alpm_logaction(alpm_handle_t *handle, const char *fmt, va_list args); int _alpm_run_chroot(alpm_handle_t *handle, const char *path, char *const argv[]); int _alpm_ldconfig(alpm_handle_t *handle); |