+ /* Copy the environment before using (g_)unsetenv() because on some
+ platforms (maybe all?) this directly modifies the environ array,
+ cause complications for iterating through it.
+ */
+
+ vector<string> ecopy;
+
+ for (size_t i = 0; environ[i]; ++i) {
+ ecopy.push_back (environ[i]);
+ }
+
+ for (vector<string>::const_iterator e = ecopy.begin(); e != ecopy.end(); ++e) {
+ string::size_type equal = (*e).find_first_of ('=');