Commit 3dc40990 authored by Diego Biurrun's avatar Diego Biurrun
Browse files

Check the return values of write() calls.

Fixes the following two warnings:
src/libdvdcss.c:380:18: warning: ignoring return value of ‘write’, declared with attribute warn_unused_result [-Wunused-result]
src/css.c:275:18: warning: ignoring return value of ‘write’, declared with attribute warn_unused_result [-Wunused-result]
parent ade3847c
...@@ -274,7 +274,11 @@ int _dvdcss_title ( dvdcss_t dvdcss, int i_block ) ...@@ -274,7 +274,11 @@ int _dvdcss_title ( dvdcss_t dvdcss, int i_block )
p_title_key[0], p_title_key[1], p_title_key[2], p_title_key[0], p_title_key[1], p_title_key[2],
p_title_key[3], p_title_key[4] ); p_title_key[3], p_title_key[4] );
write( i_fd, psz_key, PSZ_KEY_SIZE + 1 ) if(write( i_fd, psz_key, PSZ_KEY_SIZE + 1 ) < PSZ_KEY_SIZE + 1 )
{
print_error( dvdcss,
"Error caching key on disk, continuing..\n" );
}
close( i_fd ); close( i_fd );
} }
} }
......
...@@ -377,7 +377,12 @@ LIBDVDCSS_EXPORT dvdcss_t dvdcss_open ( char *psz_target ) ...@@ -377,7 +377,12 @@ LIBDVDCSS_EXPORT dvdcss_t dvdcss_open ( char *psz_target )
i_fd = open( psz_tagfile, O_RDWR|O_CREAT, 0644 ); i_fd = open( psz_tagfile, O_RDWR|O_CREAT, 0644 );
if( i_fd >= 0 ) if( i_fd >= 0 )
{ {
write( i_fd, psz_tag, strlen(psz_tag) ); ssize_t len = strlen(psz_tag);
if( write( i_fd, psz_tag, len ) < len )
{
print_error( dvdcss,
"Error writing cache directory tag, continuing..\n" );
}
close( i_fd ); close( i_fd );
} }
} }
......
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