[libdvdcss-devel] [PATCH 3/7] device: Check for errors from close() also on Windows
Jean-Baptiste Kempf
jb at videolan.org
Sun Nov 16 20:40:38 CET 2014
OK.
On 16 Nov, Diego Biurrun wrote :
> ---
> src/device.c | 26 ++++++++++++--------------
> 1 file changed, 12 insertions(+), 14 deletions(-)
>
> diff --git a/src/device.c b/src/device.c
> index 51b41be..46ab121 100644
> --- a/src/device.c
> +++ b/src/device.c
> @@ -392,27 +392,25 @@ int dvdcss_open_device ( dvdcss_t dvdcss )
> int dvdcss_close_device ( dvdcss_t dvdcss )
> {
> #if defined( WIN32 )
> - if( dvdcss->b_file )
> - {
> - close( dvdcss->i_fd );
> - }
> - else
> - {
> - CloseHandle( (HANDLE) dvdcss->i_fd );
> - }
> -
> /* Free readv temporary buffer */
> free( dvdcss->p_readv_buffer );
> dvdcss->p_readv_buffer = NULL;
> dvdcss->i_readv_buf_size = 0;
> -#else
> - int i_ret = close( dvdcss->i_fd );
> - if( i_ret < 0 )
> +
> + if( !dvdcss->b_file )
> {
> - print_error( dvdcss, "Failed to close fd, data loss possible." );
> - return i_ret;
> + CloseHandle( (HANDLE) dvdcss->i_fd );
> }
> + else
> #endif
> + {
> + int i_ret = close( dvdcss->i_fd );
> + if( i_ret < 0 )
> + {
> + print_error( dvdcss, "Failed to close fd, data loss possible." );
> + return i_ret;
> + }
> + }
>
> return 0;
> }
> --
> 2.1.0
>
> _______________________________________________
> libdvdcss-devel mailing list
> libdvdcss-devel at videolan.org
> https://mailman.videolan.org/listinfo/libdvdcss-devel
--
With my kindest regards,
--
Jean-Baptiste Kempf
http://www.jbkempf.com/ - +33 672 704 734
Sent from my Electronic Device
More information about the libdvdcss-devel
mailing list