summaryrefslogtreecommitdiff
path: root/lib/libalpm/add.c
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2007-11-04 18:02:25 -0600
committerDan McGee <dan@archlinux.org>2007-11-04 18:02:25 -0600
commitb55abdce7aebb142ce79da3aa3645afe7693a3c4 (patch)
treea19e1595cb92d4a3571a88acd76ad564fea0aead /lib/libalpm/add.c
parent99f42d6bd2116b0bd8f75394fe92255ca1f4c80b (diff)
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/add.c')
-rw-r--r--lib/libalpm/add.c4
1 files changed, 2 insertions, 2 deletions
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 */