From 2276e7677b5fc9154bc5019325100da96ca9967a Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 15 Aug 2012 22:19:03 +0200 Subject: mapper: fix potential crash in file permission check --- src/mapper.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/mapper.c b/src/mapper.c index 6a968e32d..7db74b1af 100644 --- a/src/mapper.c +++ b/src/mapper.c @@ -93,10 +93,10 @@ check_directory(const char *path) #endif DIR *dir = opendir(path); - if (dir == NULL && errno == EACCES) - g_warning("No permission to read directory: %s", path); - else + if (dir != NULL) closedir(dir); + else if (errno == EACCES) + g_warning("No permission to read directory: %s", path); } static void -- cgit v1.2.3