mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-04 13:29:59 -05:00
core-util: Add pa_unset_env()
Since we already have pa_set_env(), it's nice to also have a corresponding function for unsetting environment variables.
This commit is contained in:
parent
0e44b127d0
commit
f04e31dc5e
3 changed files with 15 additions and 6 deletions
|
|
@ -2859,6 +2859,18 @@ void pa_set_env(const char *key, const char *value) {
|
||||||
#endif
|
#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) {
|
void pa_set_env_and_record(const char *key, const char *value) {
|
||||||
pa_assert(key);
|
pa_assert(key);
|
||||||
pa_assert(value);
|
pa_assert(value);
|
||||||
|
|
@ -2881,11 +2893,7 @@ void pa_unset_env_recorded(void) {
|
||||||
if (!s)
|
if (!s)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#ifdef OS_IS_WIN32
|
pa_unset_env(s);
|
||||||
SetEnvironmentVariable(s, NULL);
|
|
||||||
#else
|
|
||||||
unsetenv(s);
|
|
||||||
#endif
|
|
||||||
pa_xfree(s);
|
pa_xfree(s);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -210,6 +210,7 @@ int pa_reset_sigs(int except, ...);
|
||||||
int pa_reset_sigsv(const int except[]);
|
int pa_reset_sigsv(const int except[]);
|
||||||
|
|
||||||
void pa_set_env(const char *key, const char *value);
|
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_set_env_and_record(const char *key, const char *value);
|
||||||
void pa_unset_env_recorded(void);
|
void pa_unset_env_recorded(void);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -92,7 +92,7 @@ int pa_start_child_for_read(const char *name, const char *argv1, pid_t *pid) {
|
||||||
|
|
||||||
/* Make sure our children are not influenced by the
|
/* Make sure our children are not influenced by the
|
||||||
* LD_BIND_NOW we set for ourselves. */
|
* LD_BIND_NOW we set for ourselves. */
|
||||||
unsetenv("LD_BIND_NOW");
|
pa_unset_env("LD_BIND_NOW");
|
||||||
|
|
||||||
#ifdef PR_SET_PDEATHSIG
|
#ifdef PR_SET_PDEATHSIG
|
||||||
/* On Linux we can use PR_SET_PDEATHSIG to have the helper
|
/* On Linux we can use PR_SET_PDEATHSIG to have the helper
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue