summaryrefslogtreecommitdiffstats
path: root/lib/libalpm/conflict.c
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2007-11-05 01:02:25 +0100
committerDan McGee <dan@archlinux.org>2007-11-05 01:02:25 +0100
commitb55abdce7aebb142ce79da3aa3645afe7693a3c4 (patch)
treea19e1595cb92d4a3571a88acd76ad564fea0aead /lib/libalpm/conflict.c
parent99f42d6bd2116b0bd8f75394fe92255ca1f4c80b (diff)
downloadpacman-b55abdce7aebb142ce79da3aa3645afe7693a3c4.tar.gz
pacman-b55abdce7aebb142ce79da3aa3645afe7693a3c4.tar.xz
libalpm: use an lstat wrapper so we never dereference dir symlinks
Linux lstat follows POSIX standards and dereferences a symlink pointing to a directory if there is a trailing slash. For purposes of libalpm, we don't want this so make a lstat wrapper that suppresses this behavior. Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'lib/libalpm/conflict.c')
-rw-r--r--lib/libalpm/conflict.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/libalpm/conflict.c b/lib/libalpm/conflict.c
index 0baef8d1..539e06ab 100644
--- a/lib/libalpm/conflict.c
+++ b/lib/libalpm/conflict.c
@@ -334,7 +334,7 @@ alpm_list_t *_alpm_db_find_conflicts(pmdb_t *db, pmtrans_t *trans, char *root)
snprintf(path, PATH_MAX, "%s%s", root, filestr);
/* stat the file - if it exists, do some checks */
- if(lstat(path, &buf) != 0) {
+ if(_alpm_lstat(path, &buf) != 0) {
continue;
}
if(S_ISDIR(buf.st_mode)) {
@@ -350,7 +350,7 @@ alpm_list_t *_alpm_db_find_conflicts(pmdb_t *db, pmtrans_t *trans, char *root)
unsigned ok = 0;
for(k = dbpkg->files; k; k = k->next) {
snprintf(str, PATH_MAX, "%s%s", root, (char*)k->data);
- if(!lstat(str, &buf2) && buf.st_ino == buf2.st_ino) {
+ if(!_alpm_lstat(str, &buf2) && buf.st_ino == buf2.st_ino) {
ok = 1;
_alpm_log(PM_LOG_DEBUG, "conflict was a symlink: %s\n", path);
break;