[vlc-devel] [PATCH 1/5] addons: Don't keep an incomplete file on error
Rémi Denis-Courmont
remi at remlab.net
Thu Nov 2 14:43:20 CET 2017
Le 2 novembre 2017 15:35:27 GMT+02:00, "Hugo Beauzée-Luyssen" <hugo at beauzee.fr> a écrit :
>---
> modules/misc/addons/fsstorage.c | 9 ++++-----
> 1 file changed, 4 insertions(+), 5 deletions(-)
>
>diff --git a/modules/misc/addons/fsstorage.c
>b/modules/misc/addons/fsstorage.c
>index 61d374eb00..9c4e4d26e2 100644
>--- a/modules/misc/addons/fsstorage.c
>+++ b/modules/misc/addons/fsstorage.c
>@@ -421,15 +421,14 @@ static int InstallFile( addons_storage_t *p_this,
>const char *psz_downloadlink,
> if ( fwrite( &buffer, i_read, 1, p_destfile ) < 1 )
> {
> msg_Err( p_this, "Failed to write to Addon file" );
>- fclose( p_destfile );
>- vlc_stream_Delete( p_stream );
>- return VLC_EGENERIC;
>+ break;
> }
> }
>-
>+ if ( i_read < 0 )
>+ vlc_unlink( psz_dest );
> fclose( p_destfile );
> vlc_stream_Delete( p_stream );
>- return VLC_SUCCESS;
>+ return i_read >= 0 ? VLC_SUCCESS : VLC_EGENERIC;
> }
>
>static int InstallAllFiles( addons_storage_t *p_this, const
>addon_entry_t *p_entry )
>--
>2.11.0
>
>_______________________________________________
>vlc-devel mailing list
>To unsubscribe or modify your subscription options:
>https://mailman.videolan.org/listinfo/vlc-devel
On Windows and possibly some file system types on Unix, you cannot delete an open file.
--
Envoyé de mon appareil Android avec Courriel K-9 Mail. Veuillez excuser ma brièveté.
More information about the vlc-devel
mailing list