From 133a39e2bb78f2be1a60094a5a398f04315df64a Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Tue, 27 Oct 2009 21:11:29 -0500 Subject: Fix opendir error condition checks Thanks to Laszlo Papp 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 Signed-off-by: Dan McGee --- src/pacman/util.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/pacman') diff --git a/src/pacman/util.c b/src/pacman/util.c index a02b43cd..c68e6841 100644 --- a/src/pacman/util.c +++ b/src/pacman/util.c @@ -174,7 +174,8 @@ int rmrf(const char *path) return(1); } - if((dirp = opendir(path)) == (DIR *)-1) { + dirp = opendir(path); + if(!dirp) { return(1); } for(dp = readdir(dirp); dp != NULL; dp = readdir(dirp)) { -- cgit v1.2.3-70-g09d2