diff options
author | Max Kellermann <max@duempel.org> | 2008-03-26 10:37:10 +0000 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2008-03-26 10:37:10 +0000 |
commit | 13c17c3d942f1074d76caeaf39ebe0d5017593e9 (patch) | |
tree | 25745db48dcd5fe6d3ac209f364294304a2ac670 /src/playlist.c | |
parent | 33e88ff8f96627920c63b2d05dc16cb7ae15f318 (diff) | |
download | mpd-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 'src/playlist.c')
-rw-r--r-- | src/playlist.c | 5 |
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]; |