[vlc-devel] [PATCH 1/5] addons: Don't keep an incomplete file on error
Hugo Beauzée-Luyssen
hugo at beauzee.fr
Thu Nov 2 14:35:27 CET 2017
---
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
More information about the vlc-devel
mailing list