From 13c17c3d942f1074d76caeaf39ebe0d5017593e9 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 26 Mar 2008 10:37:10 +0000 Subject: check the result of fopen() in all code paths The while() loop only checks for interrupted system calls (which woudl never happen if the signal mask were set up properly), but nobody checks if the fopen() actually succeeds. git-svn-id: https://svn.musicpd.org/mpd/trunk@7195 09075e82-0dd4-0310-85a5-a0d7c8717e4f --- src/playlist.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/playlist.c b/src/playlist.c index a01fc8063..e310f5fcf 100644 --- a/src/playlist.c +++ b/src/playlist.c @@ -1349,6 +1349,11 @@ int savePlaylist(int fd, char *utf8file) while (!(fp = fopen(path_max_tmp, "w")) && errno == EINTR); + if (fp == NULL) { + commandError(fd, ACK_ERROR_SYSTEM, "failed to create file"); + return -1; + } + for (i = 0; i < playlist.length; i++) { char tmp[MPD_PATH_MAX]; -- cgit v1.2.3