[pkg-fgfs-crew] Bug#757178: Bug#757178: fgrun: does not export environment variables to fgfs

Rebecca Palmer rebecca_palmer at zoho.com
Wed Aug 6 19:35:51 UTC 2014


Control: tags -1 upstream patch
Control: forwarded -1 flightgear-devel at lists.sourceforge.net

The above patch doesn't compile, but this one does, and appears to work. 
  I have reported this upstream.

--- a/src/run_posix.cxx
+++ b/src/run_posix.cxx
@@ -124,9 +124,16 @@ Wizard::run_fgfs( const std::string &args )
             buf[0] = 0;
             prefs.get( Fl_Preferences::Name("env-var-%d", i),
                        buf, "", buflen-1 );
-           char* s = strdup( buf );
-           putenv( s );
-            free( s );
+            char* equals = strchr(buf, '=');
+            if (equals == NULL) { /* environment variable name without 
a value;
+              unsetenv(buf);
+            }
+            else { /* value exists */
+              *equals = '\0'; /* replace '=' with a new terminator; the 
value f
+              setenv(/* name: */ buf,
+                     /* value: */ equals + 1,
+                     /* overwrite: */ 1);
+            }
         }
         vector<string> argv;
         argv.push_back( arg0 );



More information about the pkg-fgfs-crew mailing list