From b55abdce7aebb142ce79da3aa3645afe7693a3c4 Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Sun, 4 Nov 2007 18:02:25 -0600 Subject: 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 --- lib/libalpm/conflict.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/libalpm/conflict.c') 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; -- cgit v1.2.3-70-g09d2