Since we already have pa_set_env(), it's nice to also have a
corresponding function for unsetting environment variables.
#endif
}
+void pa_unset_env(const char *key) {
+ pa_assert(key);
+
+ /* This is not thread-safe */
+
+#ifdef OS_IS_WIN32
+ SetEnvironmentVariable(key, NULL);
+#else
+ unsetenv(key);
+#endif
+}
+
void pa_set_env_and_record(const char *key, const char *value) {
pa_assert(key);
pa_assert(value);
if (!s)
break;
-#ifdef OS_IS_WIN32
- SetEnvironmentVariable(s, NULL);
-#else
- unsetenv(s);
-#endif
+ pa_unset_env(s);
pa_xfree(s);
}
}
int pa_reset_sigsv(const int except[]);
void pa_set_env(const char *key, const char *value);
+void pa_unset_env(const char *key);
void pa_set_env_and_record(const char *key, const char *value);
void pa_unset_env_recorded(void);
/* Make sure our children are not influenced by the
* LD_BIND_NOW we set for ourselves. */
- unsetenv("LD_BIND_NOW");
+ pa_unset_env("LD_BIND_NOW");
#ifdef PR_SET_PDEATHSIG
/* On Linux we can use PR_SET_PDEATHSIG to have the helper