aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2012-08-15 22:19:03 +0200
committerMax Kellermann <max@duempel.org>2012-08-15 22:44:13 +0200
commit2276e7677b5fc9154bc5019325100da96ca9967a (patch)
treee7eb3f2617630ee0d0b5db6d03c24c72623641c2
parent93f9c2ab6b1a61456f8acbf9a243d05571d005ec (diff)
downloadmpd-2276e7677b5fc9154bc5019325100da96ca9967a.tar.gz
mpd-2276e7677b5fc9154bc5019325100da96ca9967a.tar.xz
mpd-2276e7677b5fc9154bc5019325100da96ca9967a.zip
mapper: fix potential crash in file permission check
-rw-r--r--NEWS1
-rw-r--r--src/mapper.c6
2 files changed, 4 insertions, 3 deletions
diff --git a/NEWS b/NEWS
index 4aaa75ca2..ea40aa8a8 100644
--- a/NEWS
+++ b/NEWS
@@ -10,6 +10,7 @@ ver 0.17.2 (2012/??/??)
- httpd: use monotonic clock, avoid hiccups after system clock adjustment
- httpd: fix throttling bug after resuming playback
* mapper: fix non-UTF8 music directory name
+* mapper: fix potential crash in file permission check
ver 0.17.1 (2012/07/31)
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