Date: Monday, March 19, 2007 @ 00:49:28 Author: aaron Path: /home/cvs-pacman/pacman-lib/lib/libalpm Modified: util.c (1.49 -> 1.50) Nagy Gabor <ngaba@petra.hos.u-szeged.hu> * correct _alpm_rmrf usage with regard to symlinks and directories --------+ util.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) Index: pacman-lib/lib/libalpm/util.c diff -u pacman-lib/lib/libalpm/util.c:1.49 pacman-lib/lib/libalpm/util.c:1.50 --- pacman-lib/lib/libalpm/util.c:1.49 Mon Mar 5 17:13:34 2007 +++ pacman-lib/lib/libalpm/util.c Mon Mar 19 00:49:28 2007 @@ -310,21 +310,20 @@ struct dirent *dp; DIR *dirp; char name[PATH_MAX]; - struct stat st; + struct stat st; - if(stat(path, &st) == 0) { - if(S_ISREG(st.st_mode)) { + if(lstat(path, &st) == 0) { + if(!S_ISDIR(st.st_mode)) { if(!unlink(path)) { return(0); } else { if(errno == ENOENT) { return(0); } else { - /* not a directory */ return(1); } } - } else if(S_ISDIR(st.st_mode)) { + } else { if((dirp = opendir(path)) == (DIR *)-1) { return(1); }