From e4b7a113fded192d2ad31b68a87cf444f206a04e Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sun, 25 Jul 2010 11:09:13 +0200 Subject: database, ...: remove EINTR checks after stdio calls MPD doesn't have child processes anymore, and thus we're not expecting to receive SIGCHLD very often. Since hard disk access isn't interrupted by signals anyway, we don't need those excessive checks. --- src/stored_playlist.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'src/stored_playlist.c') diff --git a/src/stored_playlist.c b/src/stored_playlist.c index 36a899034..cd2818522 100644 --- a/src/stored_playlist.c +++ b/src/stored_playlist.c @@ -160,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; @@ -170,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; } @@ -189,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; @@ -227,7 +227,7 @@ spl_load(const char *utf8path) break; } - while (fclose(file) && errno == EINTR); + fclose(file); return list; } @@ -313,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; @@ -393,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; -- cgit v1.2.3