Fail loading the playlist on errors mid-file. The same code is used for
playlistadd, playlistdelete, etc. and would've caused the playlist to be rewritten only up to the line with the error. git-svn-id: https://svn.musicpd.org/mpd/trunk@6133 09075e82-0dd4-0310-85a5-a0d7c8717e4f
This commit is contained in:
		@@ -192,6 +192,8 @@ StoredPlaylist *loadStoredPlaylist(const char *utf8path, int fd)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
					ERROR("\"%s\" too long", temp);
 | 
										ERROR("\"%s\" too long", temp);
 | 
				
			||||||
					free(temp);
 | 
										free(temp);
 | 
				
			||||||
 | 
										freeStoredPlaylist(sp);
 | 
				
			||||||
 | 
										sp = NULL;
 | 
				
			||||||
					goto out;
 | 
										goto out;
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
				free(temp);
 | 
									free(temp);
 | 
				
			||||||
@@ -211,6 +213,8 @@ StoredPlaylist *loadStoredPlaylist(const char *utf8path, int fd)
 | 
				
			|||||||
						s, utf8path);
 | 
											s, utf8path);
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			ERROR("line \"%s\" in playlist \"%s\" is too long\n", s, utf8path);
 | 
								ERROR("line \"%s\" in playlist \"%s\" is too long\n", s, utf8path);
 | 
				
			||||||
 | 
								freeStoredPlaylist(sp);
 | 
				
			||||||
 | 
								sp = NULL;
 | 
				
			||||||
			goto out;
 | 
								goto out;
 | 
				
			||||||
		} else if (s[slength] != '\r')
 | 
							} else if (s[slength] != '\r')
 | 
				
			||||||
			slength++;
 | 
								slength++;
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user