]> code.delx.au - pulseaudio/commitdiff
daemon: clean up environment when forking off children
authorLennart Poettering <lennart@poettering.net>
Tue, 1 Sep 2009 22:42:54 +0000 (00:42 +0200)
committerLennart Poettering <lennart@poettering.net>
Tue, 1 Sep 2009 22:42:54 +0000 (00:42 +0200)
src/daemon/main.c
src/pulsecore/start-child.c

index e44892daab9ad8868c192f456e001505628ce3cd..e22e465a9bb2e38543e8fb0afc36457ff8883bc9 100644 (file)
@@ -706,7 +706,7 @@ int main(int argc, char *argv[]) {
 #endif
     }
 
-    pa_set_env("PULSE_INTERNAL", "1");
+    pa_set_env_and_record("PULSE_INTERNAL", "1");
     pa_assert_se(chdir("/") == 0);
     umask(0022);
 
@@ -721,7 +721,7 @@ int main(int argc, char *argv[]) {
         if (change_user() < 0)
             goto finish;
 
-    pa_set_env("PULSE_SYSTEM", conf->system_instance ? "1" : "0");
+    pa_set_env_and_record("PULSE_SYSTEM", conf->system_instance ? "1" : "0");
 
     pa_log_info(_("This is PulseAudio %s"), PACKAGE_VERSION);
     pa_log_debug(_("Compilation host: %s"), CANONICAL_HOST);
@@ -968,6 +968,9 @@ finish:
     if (valid_pid_file)
         pa_pid_file_remove();
 
+    /* This has no real purpose except making things valgrind-clean */
+    pa_unset_env_recorded();
+
 #ifdef OS_IS_WIN32
     WSACleanup();
 #endif
index b3bce1317e3419d83b9bf988b37848cca2556d67..4a70aea139f176e834304211d215e79c51599790 100644 (file)
@@ -86,6 +86,11 @@ int pa_start_child_for_read(const char *name, const char *argv1, pid_t *pid) {
         pa_reset_sigs(-1);
         pa_unblock_sigs(-1);
         pa_reset_priority();
+        pa_unset_env_recorded();
+
+        /* Make sure our children are not influenced by the
+         * LD_BIND_NOW we set for ourselves. */
+        unsetenv("LD_BIND_NOW");
 
 #ifdef PR_SET_PDEATHSIG
         /* On Linux we can use PR_SET_PDEATHSIG to have the helper