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/add.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/libalpm/add.c') diff --git a/lib/libalpm/add.c b/lib/libalpm/add.c index a10b20d1..a76f0266 100644 --- a/lib/libalpm/add.c +++ b/lib/libalpm/add.c @@ -371,7 +371,7 @@ static int extract_single_file(struct archive *archive, * S | 7 | 8 | 9 * D | 10 | 11 | 12 * - * 1,2,3- just extract, no magic necessary. lstat will fail here. + * 1,2,3- extract, no magic necessary. lstat (_alpm_lstat) will fail here. * 4,5,6,7,8- conflict checks should have caught this. either overwrite * or backup the file. * 9- follow the symlink, hopefully it is a directory, check it. @@ -381,7 +381,7 @@ static int extract_single_file(struct archive *archive, * 12- skip extraction, dir already exists. */ struct stat lsbuf; - if(lstat(filename, &lsbuf) != 0) { + if(_alpm_lstat(filename, &lsbuf) != 0) { /* cases 1,2,3: couldn't stat an existing file, skip all backup checks */ } else { /* do a stat as well, so we can see what symlinks point to */ -- cgit v1.2.3-54-g00ecf