[libdvdcss-devel] Fix CSS key caching on Android

Ludovic Fauvet etix at videolan.org
Tue Oct 27 18:40:16 CET 2015



On Tue, Oct 27, 2015, at 18:30, Romain Bentz wrote:
> libdvdcss | branch: master | Romain Bentz <bentz.romain at gmail.com> | Tue
> Oct 27 18:17:09 2015 +0100| [c064e7cab0b490a45f5760f21d8c80553f07ed36] |
> committer: Jean-Baptiste Kempf
> 
> Fix CSS key caching on Android
> 
> Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>
> 
> > http://git.videolan.org/gitweb.cgi/libdvdcss.git/?a=commit;h=c064e7cab0b490a45f5760f21d8c80553f07ed36
> ---
> 
>  src/libdvdcss.c |   14 ++++++++++++++
>  1 file changed, 14 insertions(+)
> 
> diff --git a/src/libdvdcss.c b/src/libdvdcss.c
> index 3f4f7e6..febdff2 100644
> --- a/src/libdvdcss.c
> +++ b/src/libdvdcss.c
> @@ -216,6 +216,18 @@ static int set_cache_directory( dvdcss_t dvdcss )
>              psz_cache = dvdcss->psz_cachefile;
>          }
>  #else
> +#ifdef __ANDROID__
> +        /* $HOME is not writable on __ANDROID__ so we have to create a
> custom
> +         * directory in userland */
> +        char *psz_home =
> strdup("/sdcard/Android/data/org.videolan.dvdcss");

You have memory leak here.

This would be better according to the surrounding code:

    char psz_home[PATH_MAX];
    sprintf(psz_home, "/sdcard/Android/data/org.videolan.dvdcss");

> +
> +        int i_ret = mkdir( psz_home, 0755 );
> +        if( i_ret < 0 && errno != EEXIST )
> +        {
> +            print_error( dvdcss, "failed creating home directory" );
> +            psz_home = NULL;
> +        }
> +#else
>          char *psz_home = NULL;
>  #ifdef HAVE_PWD_H
>          struct passwd *p_pwd;
> @@ -228,6 +240,8 @@ static int set_cache_directory( dvdcss_t dvdcss )
>          }
>  #endif /* HAVE_PWD_H */
>  
> +#endif /* __ANDROID__ */
> +
>          if( psz_home == NULL )
>          {
>              psz_home = getenv( "HOME" );
> 
> _______________________________________________
> libdvdcss-devel mailing list
> libdvdcss-devel at videolan.org
> https://mailman.videolan.org/listinfo/libdvdcss-devel

Fine otherwise.

-- 
Ludovic Fauvet
www.videolan.org


More information about the libdvdcss-devel mailing list