[vlc-devel] commit: Fix [10fcb9f9c3c73d13340c0bd4153fc4c9c87b7186] (win doesn' t have setenv). ( Rémi Duraffort )

git version control git at videolan.org
Fri Aug 1 12:02:41 CEST 2008


vlc | branch: master | Rémi Duraffort <ivoire at videolan.org> | Fri Aug  1 12:04:26 2008 +0200| [5ad6561ceab66b046b648e7651ed63c071d6012d] | committer: Rémi Duraffort 

Fix [10fcb9f9c3c73d13340c0bd4153fc4c9c87b7186] (win doesn't have setenv).

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=5ad6561ceab66b046b648e7651ed63c071d6012d
---

 modules/access/dvdread.c |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/modules/access/dvdread.c b/modules/access/dvdread.c
index 2563852..a918dc9 100644
--- a/modules/access/dvdread.c
+++ b/modules/access/dvdread.c
@@ -225,7 +225,23 @@ static int Open( vlc_object_t *p_this )
     /* Override environment variable DVDCSS_METHOD with config option */
     psz_dvdcss_env = config_GetPsz( p_demux, "dvdread-css-method" );
     if( psz_dvdcss_env && *psz_dvdcss_env )
+#ifdef HAVE_SETENV
         setenv( "DVDCSS_METHOD", psz_dvdcss_env, 1 );
+#else
+    {
+        /* FIXME: this create a small memory leak */
+        char *psz_env;
+        psz_env = malloc( strlen("DVDCSS_METHOD=") +
+                          strlen( psz_dvdcss_env ) + 1 );
+        if( !psz_env )
+        {
+            free( psz_dvdcss_env );
+            return VLC_ENOMEM;
+        }
+        sprintf( psz_env, "%s%s", "DVDCSS_METHOD=", psz_dvdcss_env );
+        putenv( psz_env );
+    }
+#endif
     free( psz_dvdcss_env );
 
     /* Open dvdread */




More information about the vlc-devel mailing list