Commit 31d48b08 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

playlist: report playlist export I/O errors (fixes #10087)

parent 11e571c7
...@@ -45,7 +45,7 @@ int playlist_Export( playlist_t * p_playlist, const char *psz_filename, ...@@ -45,7 +45,7 @@ int playlist_Export( playlist_t * p_playlist, const char *psz_filename,
playlist_export_t *p_export = playlist_export_t *p_export =
vlc_custom_create( p_playlist, sizeof( *p_export ), "playlist export" ); vlc_custom_create( p_playlist, sizeof( *p_export ), "playlist export" );
if( !p_export ) if( unlikely(p_export == NULL) )
return VLC_ENOMEM; return VLC_ENOMEM;
msg_Dbg( p_export, "saving %s to file %s", msg_Dbg( p_export, "saving %s to file %s",
...@@ -58,26 +58,29 @@ int playlist_Export( playlist_t * p_playlist, const char *psz_filename, ...@@ -58,26 +58,29 @@ int playlist_Export( playlist_t * p_playlist, const char *psz_filename,
p_export->psz_filename = psz_filename; p_export->psz_filename = psz_filename;
p_export->p_file = vlc_fopen( psz_filename, "wt" ); p_export->p_file = vlc_fopen( psz_filename, "wt" );
if( p_export->p_file == NULL ) if( p_export->p_file == NULL )
{
msg_Err( p_export, "could not create playlist file %s: %s", msg_Err( p_export, "could not create playlist file %s: %s",
psz_filename, vlc_strerror_c(errno) ); 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; module_unneed( p_export, p_module );
if( !ferror( p_export->p_file ) )
/* 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 );
ret = VLC_SUCCESS; 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 ); vlc_object_release( p_export );
return ret; return ret;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment