From 5ce625ea97f20f84b25025549930394a5098246c Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Fri, 24 Apr 2009 08:57:01 +0200 Subject: stored_playlist: don't close NULL file on error spl_append_song() can crash when fopen() fails, because it attempts to close the invalid file handle (NULL) in the error handler. --- src/stored_playlist.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/stored_playlist.c b/src/stored_playlist.c index f2111aa64..f283ab98b 100644 --- a/src/stored_playlist.c +++ b/src/stored_playlist.c @@ -379,12 +379,8 @@ spl_append_song(const char *utf8path, struct song *song) while (!(file = fopen(path_fs, "a")) && errno == EINTR); g_free(path_fs); - if (file == NULL) { - int save_errno = errno; - while (fclose(file) != 0 && errno == EINTR); - errno = save_errno; + if (file == NULL) return PLAYLIST_RESULT_ERRNO; - } if (fstat(fileno(file), &st) < 0) { int save_errno = errno; -- cgit v1.2.3