Commit 3e39640f authored by Diego Biurrun's avatar Diego Biurrun

libdvdcss: Add error checking in create_cache_subdir()

parent ff00fc06
...@@ -320,19 +320,19 @@ static void create_cache_subdir( dvdcss_t dvdcss ) ...@@ -320,19 +320,19 @@ static void create_cache_subdir( dvdcss_t dvdcss )
i_ret = dvdcss->pf_seek( dvdcss, 0 ); i_ret = dvdcss->pf_seek( dvdcss, 0 );
if( i_ret != 0 ) if( i_ret != 0 )
{ {
return; goto error;
} }
i_ret = dvdcss->pf_read( dvdcss, p_sector, 1 ); i_ret = dvdcss->pf_read( dvdcss, p_sector, 1 );
if( i_ret != 1 ) if( i_ret != 1 )
{ {
return; goto error;
} }
if( p_sector[0] == 0x00 && p_sector[1] == 0x00 if( p_sector[0] == 0x00 && p_sector[1] == 0x00
&& p_sector[2] == 0x01 && p_sector[3] == 0xba ) && p_sector[2] == 0x01 && p_sector[3] == 0xba )
{ {
return; goto error;
} }
/* The data we are looking for is at sector 16 (32768 bytes): /* The data we are looking for is at sector 16 (32768 bytes):
...@@ -342,13 +342,13 @@ static void create_cache_subdir( dvdcss_t dvdcss ) ...@@ -342,13 +342,13 @@ static void create_cache_subdir( dvdcss_t dvdcss )
i_ret = dvdcss->pf_seek( dvdcss, INTERESTING_SECTOR ); i_ret = dvdcss->pf_seek( dvdcss, INTERESTING_SECTOR );
if( i_ret != INTERESTING_SECTOR ) if( i_ret != INTERESTING_SECTOR )
{ {
return; goto error;
} }
i_ret = dvdcss->pf_read( dvdcss, p_sector, 1 ); i_ret = dvdcss->pf_read( dvdcss, p_sector, 1 );
if( i_ret != 1 ) if( i_ret != 1 )
{ {
return; goto error;
} }
/* Get the disc title */ /* Get the disc title */
...@@ -410,8 +410,7 @@ static void create_cache_subdir( dvdcss_t dvdcss ) ...@@ -410,8 +410,7 @@ static void create_cache_subdir( dvdcss_t dvdcss )
if( i_ret < 0 && errno != EEXIST ) if( i_ret < 0 && errno != EEXIST )
{ {
print_error( dvdcss, "failed creating cache subdirectory" ); print_error( dvdcss, "failed creating cache subdirectory" );
dvdcss->psz_cachefile[0] = '\0'; goto error;
return;
} }
i += sprintf( dvdcss->psz_cachefile + i, "/"); i += sprintf( dvdcss->psz_cachefile + i, "/");
...@@ -420,6 +419,10 @@ static void create_cache_subdir( dvdcss_t dvdcss ) ...@@ -420,6 +419,10 @@ static void create_cache_subdir( dvdcss_t dvdcss )
print_debug( dvdcss, "using CSS key cache dir: %s", print_debug( dvdcss, "using CSS key cache dir: %s",
dvdcss->psz_cachefile ); dvdcss->psz_cachefile );
return;
error:
dvdcss->psz_cachefile[0] = '\0';
} }
static void init_cache( dvdcss_t dvdcss ) static void init_cache( dvdcss_t dvdcss )
......
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