chiark / gitweb /
core: clean up environment block for --user instances a bit
[elogind.git] / src / core / manager.c
index 1eda2b1c5ddcd38ac775ebcb0ae8227a99747a68..91c3d59d2b1f75394f119e1b956b85c292fe5f42 100644 (file)
@@ -348,11 +348,25 @@ static int manager_default_environment(Manager *m) {
 
                 /* Import locale variables LC_*= from configuration */
                 locale_setup(&m->environment);
-        } else
+        } else {
                 /* The user manager passes its own environment
                  * along to its children. */
                 m->environment = strv_copy(environ);
 
+                /* Let's remove some environment variables that we
+                 * need ourselves to communicate with our clients */
+                strv_env_unset_many(
+                                m->environment,
+                                "NOTIFY_SOCKET",
+                                "MAINPID",
+                                "MANAGERPID",
+                                "LISTEN_PID",
+                                "LISTEN_FDS",
+                                "WATCHDOG_PID",
+                                "WATCHDOG_USEC",
+                                NULL);
+        }
+
         if (!m->environment)
                 return -ENOMEM;
 
@@ -530,11 +544,13 @@ static int manager_setup_notify(Manager *m) {
 }
 
 static int manager_setup_kdbus(Manager *m) {
+#ifdef ENABLE_KDBUS
         _cleanup_free_ char *p = NULL;
+#endif
 
+#ifdef ENABLE_KDBUS
         assert(m);
 
-#ifdef ENABLE_KDBUS
         if (m->kdbus_fd >= 0)
                 return 0;