aboutsummaryrefslogtreecommitdiffstats
path: root/src/stored_playlist.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2009-01-01 19:22:07 +0100
committerMax Kellermann <max@duempel.org>2009-01-01 19:22:07 +0100
commit0c422838a8ae724e1c906028311665f0d9ea26c1 (patch)
treefed87056923c4156d7b8a865ec8620c4700db514 /src/stored_playlist.c
parent80fa9183e4d30643b1e089d9b96f36a4b266276e (diff)
downloadmpd-0c422838a8ae724e1c906028311665f0d9ea26c1.tar.gz
mpd-0c422838a8ae724e1c906028311665f0d9ea26c1.tar.xz
mpd-0c422838a8ae724e1c906028311665f0d9ea26c1.zip
playlist: use g_file_test() instead of stat()
To find out whether a file exists, use g_file_test() instead of stat(), because it is more portable and easier to use.
Diffstat (limited to 'src/stored_playlist.c')
-rw-r--r--src/stored_playlist.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/stored_playlist.c b/src/stored_playlist.c
index 534b40d2a..fa1ae7cc9 100644
--- a/src/stored_playlist.c
+++ b/src/stored_playlist.c
@@ -386,12 +386,10 @@ spl_append_uri(const char *url, const char *utf8file)
static enum playlist_result
spl_rename_internal(const char *from_path_fs, const char *to_path_fs)
{
- struct stat st;
-
- if (stat(from_path_fs, &st) != 0)
+ if (!g_file_test(from_path_fs, G_FILE_TEST_IS_REGULAR))
return PLAYLIST_RESULT_NO_SUCH_LIST;
- if (stat(to_path_fs, &st) == 0)
+ if (g_file_test(to_path_fs, G_FILE_TEST_EXISTS))
return PLAYLIST_RESULT_LIST_EXISTS;
if (rename(from_path_fs, to_path_fs) < 0)