Fix [10fcb9f9c3c73d13340c0bd4153fc4c9c87b7186] (win doesn't have setenv).
authorRémi Duraffort <ivoire@videolan.org>
Fri, 1 Aug 2008 10:04:26 +0000 (12:04 +0200)
committerRémi Duraffort <ivoire@videolan.org>
Fri, 1 Aug 2008 10:06:06 +0000 (12:06 +0200)
modules/access/dvdread.c

index 2563852..a918dc9 100644 (file)
@@ -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 */