aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2009-01-02 10:47:31 +0100
committerMax Kellermann <max@duempel.org>2009-01-02 10:47:31 +0100
commitb2e3b644838bec1877bca9999569e0f82951ec1f (patch)
tree3ca4f0b01f7a39c56fb4efff5ff2bcdd9b853906
parent38e3220fd4401f797efd3a10aa1d5bb3e8925be4 (diff)
downloadmpd-b2e3b644838bec1877bca9999569e0f82951ec1f.tar.gz
mpd-b2e3b644838bec1877bca9999569e0f82951ec1f.tar.xz
mpd-b2e3b644838bec1877bca9999569e0f82951ec1f.zip
update: use g_file_test() instead of stat()
If we want to check whether a file is a directory, use GLib's g_file_test() instead of stat().
-rw-r--r--src/update.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/update.c b/src/update.c
index 29d8844b1..01fb76ddc 100644
--- a/src/update.c
+++ b/src/update.c
@@ -192,11 +192,10 @@ removeDeletedFromDirectory(char *path_max_tmp, struct directory *directory)
for (i = dv->nr; --i >= 0; ) {
const char *path_fs;
- struct stat st;
path_fs = map_directory_fs(dv->base[i], path_max_tmp);
- if (path_fs == NULL || (stat(path_fs, &st) == 0 &&
- S_ISDIR(st.st_mode)))
+ if (path_fs == NULL ||
+ !g_file_test(path_fs, G_FILE_TEST_IS_DIR))
continue;
g_debug("removing directory: %s", dv->base[i]->path);
dirvec_delete(dv, dv->base[i]);