diff options
author | Dan McGee <dan@archlinux.org> | 2007-08-24 02:47:40 +0200 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2007-08-24 02:47:40 +0200 |
commit | 2798ebbb6286b7a0acc4b5ff10906c1a92ecc946 (patch) | |
tree | 28784ea47a493222d921462039ef1b757ae400fc | |
parent | 656c895ca4a169ec933419ab9cea1897f08799e8 (diff) | |
download | pacman-2798ebbb6286b7a0acc4b5ff10906c1a92ecc946.tar.gz pacman-2798ebbb6286b7a0acc4b5ff10906c1a92ecc946.tar.xz |
libalpm/remove.c: check for ability to unlink is wrong
As reported by JGC in FS #7652, the check for EACCES is not exactly correct.
We need to check for the ETXTBSY error as well. This is necessary on FreeBSD.
Signed-off-by: Dan McGee <dan@archlinux.org>
-rw-r--r-- | lib/libalpm/remove.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/libalpm/remove.c b/lib/libalpm/remove.c index a84d2b02..3a2e733d 100644 --- a/lib/libalpm/remove.c +++ b/lib/libalpm/remove.c @@ -32,6 +32,7 @@ #include <string.h> #include <limits.h> #include <unistd.h> +#include <sys/stat.h> /* libalpm */ #include "remove.h" @@ -164,7 +165,7 @@ static int can_remove_file(pmtrans_t *trans, const char *path) /* If we fail write permissions due to a read-only filesystem, abort. * Assume all other possible failures are covered somewhere else */ if(access(file, W_OK) == -1) { - if(errno != EACCES && access(file, F_OK) == 0) { + if(errno != EACCES && errno != ETXTBSY && access(file, F_OK) == 0) { /* only return failure if the file ACTUALLY exists and we can't write to * it - ignore "chmod -w" simple permission failures */ _alpm_log(PM_LOG_ERROR, _("cannot remove file '%s': %s"), |