diff options
author | Max Kellermann <max@duempel.org> | 2009-04-24 08:57:01 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2009-04-24 08:57:01 +0200 |
commit | 5ce625ea97f20f84b25025549930394a5098246c (patch) | |
tree | f1c9600b84fd53c332d6138cade7d05f77bccea5 | |
parent | 85658965c929b668dd5f75e5571654c488fca297 (diff) | |
download | mpd-5ce625ea97f20f84b25025549930394a5098246c.tar.gz mpd-5ce625ea97f20f84b25025549930394a5098246c.tar.xz mpd-5ce625ea97f20f84b25025549930394a5098246c.zip |
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.
-rw-r--r-- | src/stored_playlist.c | 6 |
1 files changed, 1 insertions, 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; |