[vlc-commits] playlist: report playlist export I/O errors (fixes #10087)
Rémi Denis-Courmont
git at videolan.org
Thu Apr 3 19:17:24 CEST 2014
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Thu Apr 3 20:16:49 2014 +0300| [31d48b089124a50e76486f8ef6b1fb03936a9bda] | committer: Rémi Denis-Courmont
playlist: report playlist export I/O errors (fixes #10087)
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=31d48b089124a50e76486f8ef6b1fb03936a9bda
---
src/playlist/loadsave.c | 37 ++++++++++++++++++++-----------------
1 file changed, 20 insertions(+), 17 deletions(-)
diff --git a/src/playlist/loadsave.c b/src/playlist/loadsave.c
index f8298e7..9471092 100644
--- a/src/playlist/loadsave.c
+++ b/src/playlist/loadsave.c
@@ -45,7 +45,7 @@ int playlist_Export( playlist_t * p_playlist, const char *psz_filename,
playlist_export_t *p_export =
vlc_custom_create( p_playlist, sizeof( *p_export ), "playlist export" );
- if( !p_export )
+ if( unlikely(p_export == NULL) )
return VLC_ENOMEM;
msg_Dbg( p_export, "saving %s to file %s",
@@ -58,26 +58,29 @@ int playlist_Export( playlist_t * p_playlist, const char *psz_filename,
p_export->psz_filename = psz_filename;
p_export->p_file = vlc_fopen( psz_filename, "wt" );
if( p_export->p_file == NULL )
+ {
msg_Err( p_export, "could not create playlist file %s: %s",
psz_filename, vlc_strerror_c(errno) );
- else
+ goto out;
+ }
+
+ module_t *p_module;
+
+ /* And call the module ! All work is done now */
+ playlist_Lock( p_playlist );
+ p_module = module_need( p_export, "playlist export", psz_type, true );
+ playlist_Unlock( p_playlist );
+
+ if( p_module != NULL )
{
- module_t *p_module;
-
- /* And call the module ! All work is done now */
- playlist_Lock( p_playlist );
- p_module = module_need( p_export, "playlist export", psz_type, true );
- playlist_Unlock( p_playlist );
-
- if( p_module == NULL )
- msg_Err( p_playlist, "could not export playlist" );
- else
- {
- module_unneed( p_export, p_module );
+ module_unneed( p_export, p_module );
+ if( !ferror( p_export->p_file ) )
ret = VLC_SUCCESS;
- }
- fclose( p_export->p_file );
- }
+ }
+ else
+ msg_Err( p_playlist, "could not export playlist" );
+ fclose( p_export->p_file );
+out:
vlc_object_release( p_export );
return ret;
}
More information about the vlc-commits
mailing list