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
This commit is contained in:
Max Kellermann 2008-03-26 10:37:10 +00:00 committed by Eric Wong
parent 33e88ff8f9
commit 13c17c3d94

View File

@ -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];