shithub: libdvdcss

Download patch

ref: bb6e3da30118fd64df791a60f25ac54cf7937b25
parent: e206559af30267cc1b893c5f177c2ff0ac708445
author: Diego Biurrun <diego@biurrun.de>
date: Tue Nov 18 06:54:00 EST 2014

css: Restructure control flow of win32 bits in dvdcss_test()

Avoid checking an impossible condition, skip the check instead.
This fixes CID 82126.

--- a/src/css.c
+++ b/src/css.c
@@ -107,24 +107,22 @@
 
     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,"
@@ -131,6 +129,7 @@
                      " and that you have used the correct device node." );
 
         return -1;
+#endif /* WIN32 */
     }
 
     print_debug( dvdcss, "disc reports copyright information 0x%x",