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,
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,10 +58,12 @@ 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 */
......@@ -69,15 +71,16 @@ int playlist_Export( playlist_t * p_playlist, const char *psz_filename,
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
if( p_module != NULL )
{
module_unneed( p_export, p_module );
if( !ferror( p_export->p_file ) )
ret = VLC_SUCCESS;
}
else
msg_Err( p_playlist, "could not export playlist" );
fclose( p_export->p_file );
}
out:
vlc_object_release( p_export );
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