diff options
Diffstat (limited to 'src/stored_playlist.c')
-rw-r--r-- | src/stored_playlist.c | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/src/stored_playlist.c b/src/stored_playlist.c index 5ed7182f6..cd2818522 100644 --- a/src/stored_playlist.c +++ b/src/stored_playlist.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2009 The Music Player Daemon Project + * Copyright (C) 2003-2010 The Music Player Daemon Project * http://www.musicpd.org * * This program is free software; you can redistribute it and/or modify @@ -17,6 +17,7 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ +#include "config.h" #include "stored_playlist.h" #include "playlist_save.h" #include "song.h" @@ -159,7 +160,7 @@ spl_save(GPtrArray *list, const char *utf8path) if (path_fs == NULL) return PLAYLIST_RESULT_BAD_NAME; - while (!(file = fopen(path_fs, "w")) && errno == EINTR); + file = fopen(path_fs, "w"); g_free(path_fs); if (file == NULL) return PLAYLIST_RESULT_ERRNO; @@ -169,7 +170,7 @@ spl_save(GPtrArray *list, const char *utf8path) playlist_print_uri(file, uri); } - while (fclose(file) != 0 && errno == EINTR); + fclose(file); return PLAYLIST_RESULT_SUCCESS; } @@ -188,7 +189,7 @@ spl_load(const char *utf8path) if (path_fs == NULL) return NULL; - while (!(file = fopen(path_fs, "r")) && errno == EINTR); + file = fopen(path_fs, "r"); g_free(path_fs); if (file == NULL) return NULL; @@ -226,7 +227,7 @@ spl_load(const char *utf8path) break; } - while (fclose(file) && errno == EINTR); + fclose(file); return list; } @@ -312,12 +313,12 @@ spl_clear(const char *utf8path) if (path_fs == NULL) return PLAYLIST_RESULT_BAD_NAME; - while (!(file = fopen(path_fs, "w")) && errno == EINTR); + file = fopen(path_fs, "w"); g_free(path_fs); if (file == NULL) return PLAYLIST_RESULT_ERRNO; - while (fclose(file) != 0 && errno == EINTR); + fclose(file); idle_add(IDLE_STORED_PLAYLIST); return PLAYLIST_RESULT_SUCCESS; @@ -392,26 +393,26 @@ spl_append_song(const char *utf8path, struct song *song) if (path_fs == NULL) return PLAYLIST_RESULT_BAD_NAME; - while (!(file = fopen(path_fs, "a")) && errno == EINTR); + file = fopen(path_fs, "a"); g_free(path_fs); if (file == NULL) return PLAYLIST_RESULT_ERRNO; if (fstat(fileno(file), &st) < 0) { int save_errno = errno; - while (fclose(file) != 0 && errno == EINTR); + fclose(file); errno = save_errno; return PLAYLIST_RESULT_ERRNO; } if (st.st_size / (MPD_PATH_MAX + 1) >= (off_t)playlist_max_length) { - while (fclose(file) != 0 && errno == EINTR); + fclose(file); return PLAYLIST_RESULT_TOO_LARGE; } playlist_print_song(file, song); - while (fclose(file) != 0 && errno == EINTR); + fclose(file); idle_add(IDLE_STORED_PLAYLIST); return PLAYLIST_RESULT_SUCCESS; |