[libdvdcss-devel] [PATCH 4/4] css: Restructure control flow of win32 bits in dvdcss_test()

Diego Biurrun diego at biurrun.de
Tue Nov 18 23:46:26 CET 2014


Avoid checking an impossible condition, skip the check instead.
This fixes CID 82126.
---
 src/css.c | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/src/css.c b/src/css.c
index 4043efe..fef2ae5 100644
--- a/src/css.c
+++ b/src/css.c
@@ -107,30 +107,29 @@ int dvdcss_test( dvdcss_t dvdcss )
 
     i_ret = ioctl_ReadCopyright( dvdcss->i_fd, 0 /* i_layer */, &i_copyright );
 
-#ifdef WIN32
     if( i_ret < 0 )
     {
+#ifdef WIN32
         /* Maybe we didn't have enough privileges to read the copyright
          * (see ioctl_ReadCopyright comments).
          * Apparently, on unencrypted DVDs dvdcss_disckey() always fails, so
          * we can check this as a workaround. */
-        i_ret = 0;
-        i_copyright = 1;
         if( dvdcss_disckey( dvdcss ) < 0 )
         {
             i_copyright = 0;
         }
-    }
-#endif /* WIN32 */
-
-    if( i_ret < 0 )
-    {
+        else
+        {
+            i_copyright = 1;
+        }
+#else
         /* Since it's the first ioctl we try to issue, we add a notice */
         print_error( dvdcss, "CSS error: could not get \"copyright\""
                      " information, make sure there is a DVD in the drive,"
                      " and that you have used the correct device node." );
 
         return -1;
+#endif /* WIN32 */
     }
 
     print_debug( dvdcss, "disc reports copyright information 0x%x",
-- 
2.1.0



More information about the libdvdcss-devel mailing list