mirror of
https://github.com/moparisthebest/pacman
synced 2025-01-10 21:38:19 -05:00
Fix opendir error condition checks
Thanks to Laszlo Papp <djszapi@archlinux.us> for the following catch: opendir(path)) == (DIR *)-1; is maybe the result of misunderstanding the manpage. If an opendir() call isn't successful it returns NULL rather than '(DIR *)-1'. Noticed-by: Laszlo Papp <djszapi@archlinux.us> Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
parent
fff6d9dc2e
commit
133a39e2bb
@ -404,7 +404,8 @@ int _alpm_rmrf(const char *path)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if((dirp = opendir(path)) == (DIR *)-1) {
|
dirp = opendir(path);
|
||||||
|
if(!dirp) {
|
||||||
return(1);
|
return(1);
|
||||||
}
|
}
|
||||||
for(dp = readdir(dirp); dp != NULL; dp = readdir(dirp)) {
|
for(dp = readdir(dirp); dp != NULL; dp = readdir(dirp)) {
|
||||||
|
@ -174,7 +174,8 @@ int rmrf(const char *path)
|
|||||||
return(1);
|
return(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if((dirp = opendir(path)) == (DIR *)-1) {
|
dirp = opendir(path);
|
||||||
|
if(!dirp) {
|
||||||
return(1);
|
return(1);
|
||||||
}
|
}
|
||||||
for(dp = readdir(dirp); dp != NULL; dp = readdir(dirp)) {
|
for(dp = readdir(dirp); dp != NULL; dp = readdir(dirp)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user