aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-03-26 10:37:10 +0000
committerEric Wong <normalperson@yhbt.net>2008-03-26 10:37:10 +0000
commit13c17c3d942f1074d76caeaf39ebe0d5017593e9 (patch)
tree25745db48dcd5fe6d3ac209f364294304a2ac670 /src
parent33e88ff8f96627920c63b2d05dc16cb7ae15f318 (diff)
downloadmpd-13c17c3d942f1074d76caeaf39ebe0d5017593e9.tar.gz
mpd-13c17c3d942f1074d76caeaf39ebe0d5017593e9.tar.xz
mpd-13c17c3d942f1074d76caeaf39ebe0d5017593e9.zip
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
Diffstat (limited to '')
-rw-r--r--src/playlist.c5
1 files changed, 5 insertions, 0 deletions
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];