[pacman-dev] [PATCH 4/5] check_file_exists: replace lstat with llstat

Andrew Gregory andrew.gregory.8 at gmail.com
Thu Jun 26 12:52:58 EDT 2014


Paths are constructed directly from package file lists and may contain
trailing slashes, causing lstat to dereference symlinks.

Signed-off-by: Andrew Gregory <andrew.gregory.8 at gmail.com>
---
 src/pacman/check.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/pacman/check.c b/src/pacman/check.c
index a7c66ba..60a038a 100644
--- a/src/pacman/check.c
+++ b/src/pacman/check.c
@@ -26,11 +26,11 @@
 #include "conf.h"
 #include "util.h"
 
-static int check_file_exists(const char *pkgname, const char * filepath,
-		struct stat * st)
+static int check_file_exists(const char *pkgname, char *filepath,
+		struct stat *st)
 {
 	/* use lstat to prevent errors from symlinks */
-	if(lstat(filepath, st) != 0) {
+	if(llstat(filepath, st) != 0) {
 		if(config->quiet) {
 			printf("%s %s\n", pkgname, filepath);
 		} else {
-- 
2.0.0



More information about the pacman-dev mailing list