mirror of
https://github.com/moparisthebest/pacman
synced 2024-11-12 04:15:06 -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:
parent
bd55cf548c
commit
22206d5bea
@ -312,19 +312,18 @@ int _alpm_rmrf(const char *path)
|
|||||||
char name[PATH_MAX];
|
char name[PATH_MAX];
|
||||||
struct stat st;
|
struct stat st;
|
||||||
|
|
||||||
if(stat(path, &st) == 0) {
|
if(lstat(path, &st) == 0) {
|
||||||
if(S_ISREG(st.st_mode)) {
|
if(!S_ISDIR(st.st_mode)) {
|
||||||
if(!unlink(path)) {
|
if(!unlink(path)) {
|
||||||
return(0);
|
return(0);
|
||||||
} else {
|
} else {
|
||||||
if(errno == ENOENT) {
|
if(errno == ENOENT) {
|
||||||
return(0);
|
return(0);
|
||||||
} else {
|
} else {
|
||||||
/* not a directory */
|
|
||||||
return(1);
|
return(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if(S_ISDIR(st.st_mode)) {
|
} else {
|
||||||
if((dirp = opendir(path)) == (DIR *)-1) {
|
if((dirp = opendir(path)) == (DIR *)-1) {
|
||||||
return(1);
|
return(1);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user