shithub: libdvdcss

Download patch

ref: 3dc40990ab9c9da2e9ed728d540c312b78d8a6bc
parent: ade3847c6f77c4f413fd895120eed2086ff9caee
author: Diego Biurrun <diego@biurrun.de>
date: Fri Mar 15 11:53:40 EDT 2013

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]

--- a/src/css.c
+++ b/src/css.c
@@ -274,7 +274,11 @@
                               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 );
         }
     }
--- a/src/libdvdcss.c
+++ b/src/libdvdcss.c
@@ -377,7 +377,12 @@
         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 );
         }
     }