[libdvdcss-devel] Check the return values of write() calls.
Diego Biurrun
git at videolan.org
Sun Mar 17 14:56:36 CET 2013
libdvdcss | branch: master | Diego Biurrun <diego at biurrun.de> | Fri Mar 15 15:53:40 2013 +0100| [3dc40990ab9c9da2e9ed728d540c312b78d8a6bc] | committer: Diego Biurrun
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]
> http://git.videolan.org/gitweb.cgi/libdvdcss.git/?a=commit;h=3dc40990ab9c9da2e9ed728d540c312b78d8a6bc
---
src/css.c | 6 +++++-
src/libdvdcss.c | 7 ++++++-
2 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/src/css.c b/src/css.c
index a8b8e0e..681bb2c 100644
--- a/src/css.c
+++ b/src/css.c
@@ -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[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 );
}
}
diff --git a/src/libdvdcss.c b/src/libdvdcss.c
index 2a1a5bb..f1fbd9d 100644
--- a/src/libdvdcss.c
+++ b/src/libdvdcss.c
@@ -377,7 +377,12 @@ LIBDVDCSS_EXPORT dvdcss_t dvdcss_open ( char *psz_target )
i_fd = open( psz_tagfile, O_RDWR|O_CREAT, 0644 );
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 );
}
}
More information about the libdvdcss-devel
mailing list