1
0
mirror of https://github.com/moparisthebest/pacman synced 2024-12-22 15:58:50 -05:00

Nagy Gabor <ngaba@petra.hos.u-szeged.hu>

* correct _alpm_rmrf usage with regard to symlinks and directories
This commit is contained in:
Aaron Griffin 2007-03-19 04:49:28 +00:00
parent bd55cf548c
commit 22206d5bea

View File

@ -310,21 +310,20 @@ int _alpm_rmrf(const char *path)
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);
}