chiark / gitweb /
manager: no need to use randomized generator dir when running as system manager
[elogind.git] / src / dbus-manager.c
index a2a25b72ffdd6053e9879498ba63595740f05762..5b5bda2119aea27d22ca1e998adb7fdb4bc22722 100644 (file)
@@ -20,6 +20,7 @@
 ***/
 
 #include <errno.h>
+#include <unistd.h>
 
 #include "dbus.h"
 #include "log.h"
@@ -217,23 +218,24 @@ static DEFINE_BUS_PROPERTY_APPEND_ENUM(bus_manager_append_exec_output, exec_outp
 
 static int bus_manager_append_tainted(Manager *m, DBusMessageIter *i, const char *property, void *data) {
         const char *t;
-        char buf[64] = "", *e = buf, *p = NULL;
+        char buf[LINE_MAX] = "", *e = buf, *p = NULL;
 
         assert(m);
         assert(i);
         assert(property);
 
         if (m->taint_usr)
-                e = stpcpy(e, "usr-separate-fs");
+                e = stpcpy(e, "usr-separate-fs ");
 
-        if (readlink_malloc("/etc/mtab", &p) < 0) {
-                if (e != buf)
-                        e = stpcpy(e, " ");
-                e = stpcpy(e, "etc-mtab-not-symlink");
-        } else
+        if (readlink_malloc("/etc/mtab", &p) < 0)
+                e = stpcpy(e, "etc-mtab-not-symlink ");
+        else
                 free(p);
 
-        t = buf;
+        if (access("/proc/cgroups", F_OK) < 0)
+                e = stpcpy(e, "cgroups-missing ");
+
+        t = strstrip(buf);
 
         if (!dbus_message_iter_append_basic(i, DBUS_TYPE_STRING, &t))
                 return -ENOMEM;
@@ -1018,8 +1020,10 @@ static DBusHandlerResult bus_manager_message_handler(DBusConnection *connection,
                 if (!e)
                         goto oom;
 
-                if (!(reply = dbus_message_new_method_return(message)))
+                if (!(reply = dbus_message_new_method_return(message))) {
+                        strv_free(e);
                         goto oom;
+                }
 
                 strv_free(m->environment);
                 m->environment = e;
@@ -1106,8 +1110,6 @@ static DBusHandlerResult bus_manager_message_handler(DBusConnection *connection,
                         goto oom;
         }
 
-        free(path);
-
         if (reply) {
                 if (!dbus_connection_send(connection, reply, NULL))
                         goto oom;
@@ -1115,6 +1117,8 @@ static DBusHandlerResult bus_manager_message_handler(DBusConnection *connection,
                 dbus_message_unref(reply);
         }
 
+        free(path);
+
         return DBUS_HANDLER_RESULT_HANDLED;
 
 oom: