[systemd-commits] 3 commits - fixme src/auto-serial-getty.c src/cgroups-agent.c src/dbus-common.c src/dbus-common.h src/initctl.c src/sd-daemon.c src/systemctl.c src/update-utmp.c

Lennart Poettering lennart at kemper.freedesktop.org
Wed Aug 25 10:50:14 PDT 2010


 fixme                   |   10 +++--
 src/auto-serial-getty.c |    4 +-
 src/cgroups-agent.c     |    2 -
 src/dbus-common.c       |   11 ++++++
 src/dbus-common.h       |    2 +
 src/initctl.c           |    4 +-
 src/sd-daemon.c         |   17 ---------
 src/systemctl.c         |   82 ++++++++++++++++++++++++------------------------
 src/update-utmp.c       |    8 ++--
 9 files changed, 69 insertions(+), 71 deletions(-)

New commits:
commit 9d2205426a54e4eeab18bd7d83bc2fbb43eca4a4
Author: Lennart Poettering <lennart at poettering.net>
Date:   Wed Aug 25 19:49:52 2010 +0200

    update fixme

diff --git a/fixme b/fixme
index 08fa5d4..4ee7815 100644
--- a/fixme
+++ b/fixme
@@ -72,10 +72,6 @@
 
 * auditd service files
 
-* override the human readable dbus error code for permission denied.
-
-* discuss reexec on shutdown, async. vs. sync?
-
 * auto-serial-getty vs. isolate
 
 * add RefuseManualIsolate= (default on?)
commit 4cf5d6750704bb393b0d5dcb5ed4657810cff783
Author: Lennart Poettering <lennart at poettering.net>
Date:   Wed Aug 25 19:49:23 2010 +0200

    dbus: simplify some dbus error messages a bit

diff --git a/src/auto-serial-getty.c b/src/auto-serial-getty.c
index 7bc2fba..355cdfd 100644
--- a/src/auto-serial-getty.c
+++ b/src/auto-serial-getty.c
@@ -59,7 +59,7 @@ static int spawn_getty(DBusConnection *bus, const char *console) {
         }
 
         if (!(reply = dbus_connection_send_with_reply_and_block(bus, m, -1, &error))) {
-                log_error("Failed to start unit: %s", error.message);
+                log_error("Failed to start unit: %s", bus_error_message(&error));
                 goto finish;
         }
 
@@ -160,7 +160,7 @@ int main(int argc, char *argv[]) {
         log_open();
 
         if (bus_connect(DBUS_BUS_SYSTEM, &bus, NULL, &error) < 0) {
-                log_error("Failed to get D-Bus connection: %s", error.message);
+                log_error("Failed to get D-Bus connection: %s", bus_error_message(&error));
                 goto finish;
         }
 
diff --git a/src/cgroups-agent.c b/src/cgroups-agent.c
index 92b56c5..af458b2 100644
--- a/src/cgroups-agent.c
+++ b/src/cgroups-agent.c
@@ -49,7 +49,7 @@ int main(int argc, char *argv[]) {
                 dbus_error_free(&error);
 
                 if (!(bus = dbus_connection_open_private("unix:abstract=/org/freedesktop/systemd1/private", &error))) {
-                        log_error("Failed to get D-Bus connection: %s", error.message);
+                        log_error("Failed to get D-Bus connection: %s", bus_error_message(&error));
                         goto finish;
                 }
 
diff --git a/src/dbus-common.c b/src/dbus-common.c
index 628efae..69593cd 100644
--- a/src/dbus-common.c
+++ b/src/dbus-common.c
@@ -88,3 +88,14 @@ int bus_connect(DBusBusType t, DBusConnection **_bus, bool *private, DBusError *
         *_bus = bus;
         return 0;
 }
+
+const char *bus_error_message(const DBusError *error) {
+        assert(error);
+
+        /* Sometimes the D-Bus server is a little bit too verbose with
+         * its error messages, so let's override them here */
+        if (dbus_error_has_name(error, DBUS_ERROR_ACCESS_DENIED))
+                return "Access denied";
+
+        return error->message;
+}
diff --git a/src/dbus-common.h b/src/dbus-common.h
index ebcddec..9a66b78 100644
--- a/src/dbus-common.h
+++ b/src/dbus-common.h
@@ -28,4 +28,6 @@ int bus_check_peercred(DBusConnection *c);
 
 int bus_connect(DBusBusType t, DBusConnection **_bus, bool *private_bus, DBusError *error);
 
+const char *bus_error_message(const DBusError *error);
+
 #endif
diff --git a/src/initctl.c b/src/initctl.c
index 7b478a7..12b0e89 100644
--- a/src/initctl.c
+++ b/src/initctl.c
@@ -124,7 +124,7 @@ static void change_runlevel(Server *s, int runlevel) {
         }
 
         if (!(reply = dbus_connection_send_with_reply_and_block(s->bus, m, -1, &error))) {
-                log_error("Failed to start unit: %s", error.message);
+                log_error("Failed to start unit: %s", bus_error_message(&error));
                 goto finish;
         }
 
@@ -298,7 +298,7 @@ static int server_init(Server *s, unsigned n_sockets) {
         }
 
         if (bus_connect(DBUS_BUS_SYSTEM, &s->bus, NULL, &error) < 0) {
-                log_error("Failed to get D-Bus connection: %s", error.message);
+                log_error("Failed to get D-Bus connection: %s", bus_error_message(&error));
                 goto fail;
         }
 
diff --git a/src/systemctl.c b/src/systemctl.c
index 9da8303..bfb7001 100644
--- a/src/systemctl.c
+++ b/src/systemctl.c
@@ -249,7 +249,7 @@ static int list_units(DBusConnection *bus, char **args, unsigned n) {
         }
 
         if (!(reply = dbus_connection_send_with_reply_and_block(bus, m, -1, &error))) {
-                log_error("Failed to issue method call: %s", error.message);
+                log_error("Failed to issue method call: %s", bus_error_message(&error));
                 r = -EIO;
                 goto finish;
         }
@@ -473,7 +473,7 @@ static int dot_one(DBusConnection *bus, const char *name, const char *path) {
         }
 
         if (!(reply = dbus_connection_send_with_reply_and_block(bus, m, -1, &error))) {
-                log_error("Failed to issue method call: %s", error.message);
+                log_error("Failed to issue method call: %s", bus_error_message(&error));
                 r = -EIO;
                 goto finish;
         }
@@ -556,7 +556,7 @@ static int dot(DBusConnection *bus, char **args, unsigned n) {
         }
 
         if (!(reply = dbus_connection_send_with_reply_and_block(bus, m, -1, &error))) {
-                log_error("Failed to issue method call: %s", error.message);
+                log_error("Failed to issue method call: %s", bus_error_message(&error));
                 r = -EIO;
                 goto finish;
         }
@@ -649,7 +649,7 @@ static int list_jobs(DBusConnection *bus, char **args, unsigned n) {
         }
 
         if (!(reply = dbus_connection_send_with_reply_and_block(bus, m, -1, &error))) {
-                log_error("Failed to issue method call: %s", error.message);
+                log_error("Failed to issue method call: %s", bus_error_message(&error));
                 r = -EIO;
                 goto finish;
         }
@@ -746,7 +746,7 @@ static int load_unit(DBusConnection *bus, char **args, unsigned n) {
                 }
 
                 if (!(reply = dbus_connection_send_with_reply_and_block(bus, m, -1, &error))) {
-                        log_error("Failed to issue method call: %s", error.message);
+                        log_error("Failed to issue method call: %s", bus_error_message(&error));
                         r = -EIO;
                         goto finish;
                 }
@@ -814,7 +814,7 @@ static int cancel_job(DBusConnection *bus, char **args, unsigned n) {
                 }
 
                 if (!(reply = dbus_connection_send_with_reply_and_block(bus, m, -1, &error))) {
-                        log_error("Failed to issue method call: %s", error.message);
+                        log_error("Failed to issue method call: %s", bus_error_message(&error));
                         r = -EIO;
                         goto finish;
                 }
@@ -822,7 +822,7 @@ static int cancel_job(DBusConnection *bus, char **args, unsigned n) {
                 if (!dbus_message_get_args(reply, &error,
                                            DBUS_TYPE_OBJECT_PATH, &path,
                                            DBUS_TYPE_INVALID)) {
-                        log_error("Failed to parse reply: %s", error.message);
+                        log_error("Failed to parse reply: %s", bus_error_message(&error));
                         r = -EIO;
                         goto finish;
                 }
@@ -840,7 +840,7 @@ static int cancel_job(DBusConnection *bus, char **args, unsigned n) {
 
                 dbus_message_unref(reply);
                 if (!(reply = dbus_connection_send_with_reply_and_block(bus, m, -1, &error))) {
-                        log_error("Failed to issue method call: %s", error.message);
+                        log_error("Failed to issue method call: %s", bus_error_message(&error));
                         r = -EIO;
                         goto finish;
                 }
@@ -969,7 +969,7 @@ static DBusHandlerResult wait_filter(DBusConnection *connection, DBusMessage *me
                                            DBUS_TYPE_OBJECT_PATH, &path,
                                            DBUS_TYPE_BOOLEAN, &success,
                                            DBUS_TYPE_INVALID))
-                        log_error("Failed to parse message: %s", error.message);
+                        log_error("Failed to parse message: %s", bus_error_message(&error));
                 else {
                         char *p;
 
@@ -1003,7 +1003,7 @@ static int enable_wait_for_jobs(DBusConnection *bus) {
                            &error);
 
         if (dbus_error_is_set(&error)) {
-                log_error("Failed to add match: %s", error.message);
+                log_error("Failed to add match: %s", bus_error_message(&error));
                 dbus_error_free(&error);
                 return -EIO;
         }
@@ -1092,7 +1092,7 @@ static int start_unit_one(
                         goto finish;
                 }
 
-                log_error("Failed to issue method call: %s", error.message);
+                log_error("Failed to issue method call: %s", bus_error_message(&error));
                 r = -EIO;
                 goto finish;
         }
@@ -1100,7 +1100,7 @@ static int start_unit_one(
         if (!dbus_message_get_args(reply, &error,
                                    DBUS_TYPE_OBJECT_PATH, &path,
                                    DBUS_TYPE_INVALID)) {
-                log_error("Failed to parse reply: %s", error.message);
+                log_error("Failed to parse reply: %s", bus_error_message(&error));
                 r = -EIO;
                 goto finish;
         }
@@ -1312,7 +1312,7 @@ static int check_unit(DBusConnection *bus, char **args, unsigned n) {
                 if (!dbus_message_get_args(reply, &error,
                                            DBUS_TYPE_OBJECT_PATH, &path,
                                            DBUS_TYPE_INVALID)) {
-                        log_error("Failed to parse reply: %s", error.message);
+                        log_error("Failed to parse reply: %s", bus_error_message(&error));
                         r = -EIO;
                         goto finish;
                 }
@@ -1339,7 +1339,7 @@ static int check_unit(DBusConnection *bus, char **args, unsigned n) {
 
                 dbus_message_unref(reply);
                 if (!(reply = dbus_connection_send_with_reply_and_block(bus, m, -1, &error))) {
-                        log_error("Failed to issue method call: %s", error.message);
+                        log_error("Failed to issue method call: %s", bus_error_message(&error));
                         r = -EIO;
                         goto finish;
                 }
@@ -2129,7 +2129,7 @@ static int show_one(DBusConnection *bus, const char *path, bool show_properties,
         }
 
         if (!(reply = dbus_connection_send_with_reply_and_block(bus, m, -1, &error))) {
-                log_error("Failed to issue method call: %s", error.message);
+                log_error("Failed to issue method call: %s", bus_error_message(&error));
                 r = -EIO;
                 goto finish;
         }
@@ -2272,7 +2272,7 @@ static int show(DBusConnection *bus, char **args, unsigned n) {
                         if (!(reply = dbus_connection_send_with_reply_and_block(bus, m, -1, &error))) {
 
                                 if (!dbus_error_has_name(&error, DBUS_ERROR_ACCESS_DENIED)) {
-                                        log_error("Failed to issue method call: %s", error.message);
+                                        log_error("Failed to issue method call: %s", bus_error_message(&error));
                                         r = -EIO;
                                         goto finish;
                                 }
@@ -2299,7 +2299,7 @@ static int show(DBusConnection *bus, char **args, unsigned n) {
                                 }
 
                                 if (!(reply = dbus_connection_send_with_reply_and_block(bus, m, -1, &error))) {
-                                        log_error("Failed to issue method call: %s", error.message);
+                                        log_error("Failed to issue method call: %s", bus_error_message(&error));
                                         r = -EIO;
                                         goto finish;
                                 }
@@ -2328,7 +2328,7 @@ static int show(DBusConnection *bus, char **args, unsigned n) {
                         }
 
                         if (!(reply = dbus_connection_send_with_reply_and_block(bus, m, -1, &error))) {
-                                log_error("Failed to issue method call: %s", error.message);
+                                log_error("Failed to issue method call: %s", bus_error_message(&error));
                                 r = -EIO;
                                 goto finish;
                         }
@@ -2355,7 +2355,7 @@ static int show(DBusConnection *bus, char **args, unsigned n) {
                         }
 
                         if (!(reply = dbus_connection_send_with_reply_and_block(bus, m, -1, &error))) {
-                                log_error("Failed to issue method call: %s", error.message);
+                                log_error("Failed to issue method call: %s", bus_error_message(&error));
                                 r = -EIO;
                                 goto finish;
                         }
@@ -2364,7 +2364,7 @@ static int show(DBusConnection *bus, char **args, unsigned n) {
                 if (!dbus_message_get_args(reply, &error,
                                            DBUS_TYPE_OBJECT_PATH, &path,
                                            DBUS_TYPE_INVALID)) {
-                        log_error("Failed to parse reply: %s", error.message);
+                        log_error("Failed to parse reply: %s", bus_error_message(&error));
                         r = -EIO;
                         goto finish;
                 }
@@ -2417,7 +2417,7 @@ static DBusHandlerResult monitor_filter(DBusConnection *connection, DBusMessage
                                            DBUS_TYPE_STRING, &id,
                                            DBUS_TYPE_OBJECT_PATH, &path,
                                            DBUS_TYPE_INVALID))
-                        log_error("Failed to parse message: %s", error.message);
+                        log_error("Failed to parse message: %s", bus_error_message(&error));
                 else if (streq(dbus_message_get_member(message), "UnitNew"))
                         printf("Unit %s added.\n", id);
                 else
@@ -2432,7 +2432,7 @@ static DBusHandlerResult monitor_filter(DBusConnection *connection, DBusMessage
                                            DBUS_TYPE_UINT32, &id,
                                            DBUS_TYPE_OBJECT_PATH, &path,
                                            DBUS_TYPE_INVALID))
-                        log_error("Failed to parse message: %s", error.message);
+                        log_error("Failed to parse message: %s", bus_error_message(&error));
                 else if (streq(dbus_message_get_member(message), "JobNew"))
                         printf("Job %u added.\n", id);
                 else
@@ -2449,7 +2449,7 @@ static DBusHandlerResult monitor_filter(DBusConnection *connection, DBusMessage
                 if (!dbus_message_get_args(message, &error,
                                           DBUS_TYPE_STRING, &interface,
                                           DBUS_TYPE_INVALID)) {
-                        log_error("Failed to parse message: %s", error.message);
+                        log_error("Failed to parse message: %s", bus_error_message(&error));
                         goto finish;
                 }
 
@@ -2475,7 +2475,7 @@ static DBusHandlerResult monitor_filter(DBusConnection *connection, DBusMessage
                 }
 
                 if (!(reply = dbus_connection_send_with_reply_and_block(connection, m, -1, &error))) {
-                        log_error("Failed to issue method call: %s", error.message);
+                        log_error("Failed to issue method call: %s", bus_error_message(&error));
                         goto finish;
                 }
 
@@ -2547,7 +2547,7 @@ static int monitor(DBusConnection *bus, char **args, unsigned n) {
                                    &error);
 
                 if (dbus_error_is_set(&error)) {
-                        log_error("Failed to add match: %s", error.message);
+                        log_error("Failed to add match: %s", bus_error_message(&error));
                         r = -EIO;
                         goto finish;
                 }
@@ -2560,7 +2560,7 @@ static int monitor(DBusConnection *bus, char **args, unsigned n) {
                                    &error);
 
                 if (dbus_error_is_set(&error)) {
-                        log_error("Failed to add match: %s", error.message);
+                        log_error("Failed to add match: %s", bus_error_message(&error));
                         r = -EIO;
                         goto finish;
                 }
@@ -2583,7 +2583,7 @@ static int monitor(DBusConnection *bus, char **args, unsigned n) {
         }
 
         if (!(reply = dbus_connection_send_with_reply_and_block(bus, m, -1, &error))) {
-                log_error("Failed to issue method call: %s", error.message);
+                log_error("Failed to issue method call: %s", bus_error_message(&error));
                 r = -EIO;
                 goto finish;
         }
@@ -2626,7 +2626,7 @@ static int dump(DBusConnection *bus, char **args, unsigned n) {
         }
 
         if (!(reply = dbus_connection_send_with_reply_and_block(bus, m, -1, &error))) {
-                log_error("Failed to issue method call: %s", error.message);
+                log_error("Failed to issue method call: %s", bus_error_message(&error));
                 r = -EIO;
                 goto finish;
         }
@@ -2634,7 +2634,7 @@ static int dump(DBusConnection *bus, char **args, unsigned n) {
         if (!dbus_message_get_args(reply, &error,
                                    DBUS_TYPE_STRING, &text,
                                    DBUS_TYPE_INVALID)) {
-                log_error("Failed to parse reply: %s", error.message);
+                log_error("Failed to parse reply: %s", bus_error_message(&error));
                 r = -EIO;
                 goto finish;
         }
@@ -2690,7 +2690,7 @@ static int snapshot(DBusConnection *bus, char **args, unsigned n) {
         }
 
         if (!(reply = dbus_connection_send_with_reply_and_block(bus, m, -1, &error))) {
-                log_error("Failed to issue method call: %s", error.message);
+                log_error("Failed to issue method call: %s", bus_error_message(&error));
                 r = -EIO;
                 goto finish;
         }
@@ -2698,7 +2698,7 @@ static int snapshot(DBusConnection *bus, char **args, unsigned n) {
         if (!dbus_message_get_args(reply, &error,
                                    DBUS_TYPE_OBJECT_PATH, &path,
                                    DBUS_TYPE_INVALID)) {
-                log_error("Failed to parse reply: %s", error.message);
+                log_error("Failed to parse reply: %s", bus_error_message(&error));
                 r = -EIO;
                 goto finish;
         }
@@ -2724,7 +2724,7 @@ static int snapshot(DBusConnection *bus, char **args, unsigned n) {
 
         dbus_message_unref(reply);
         if (!(reply = dbus_connection_send_with_reply_and_block(bus, m, -1, &error))) {
-                log_error("Failed to issue method call: %s", error.message);
+                log_error("Failed to issue method call: %s", bus_error_message(&error));
                 r = -EIO;
                 goto finish;
         }
@@ -2795,7 +2795,7 @@ static int delete_snapshot(DBusConnection *bus, char **args, unsigned n) {
                 }
 
                 if (!(reply = dbus_connection_send_with_reply_and_block(bus, m, -1, &error))) {
-                        log_error("Failed to issue method call: %s", error.message);
+                        log_error("Failed to issue method call: %s", bus_error_message(&error));
                         r = -EIO;
                         goto finish;
                 }
@@ -2803,7 +2803,7 @@ static int delete_snapshot(DBusConnection *bus, char **args, unsigned n) {
                 if (!dbus_message_get_args(reply, &error,
                                            DBUS_TYPE_OBJECT_PATH, &path,
                                            DBUS_TYPE_INVALID)) {
-                        log_error("Failed to parse reply: %s", error.message);
+                        log_error("Failed to parse reply: %s", bus_error_message(&error));
                         r = -EIO;
                         goto finish;
                 }
@@ -2821,7 +2821,7 @@ static int delete_snapshot(DBusConnection *bus, char **args, unsigned n) {
 
                 dbus_message_unref(reply);
                 if (!(reply = dbus_connection_send_with_reply_and_block(bus, m, -1, &error))) {
-                        log_error("Failed to issue method call: %s", error.message);
+                        log_error("Failed to issue method call: %s", bus_error_message(&error));
                         r = -EIO;
                         goto finish;
                 }
@@ -2887,7 +2887,7 @@ static int daemon_reload(DBusConnection *bus, char **args, unsigned n) {
                         goto finish;
                 }
 
-                log_error("Failed to issue method call: %s", error.message);
+                log_error("Failed to issue method call: %s", bus_error_message(&error));
                 r = -EIO;
                 goto finish;
         }
@@ -2939,7 +2939,7 @@ static int reset_maintenance(DBusConnection *bus, char **args, unsigned n) {
                 }
 
                 if (!(reply = dbus_connection_send_with_reply_and_block(bus, m, -1, &error))) {
-                        log_error("Failed to issue method call: %s", error.message);
+                        log_error("Failed to issue method call: %s", bus_error_message(&error));
                         r = -EIO;
                         goto finish;
                 }
@@ -2993,7 +2993,7 @@ static int show_enviroment(DBusConnection *bus, char **args, unsigned n) {
         }
 
         if (!(reply = dbus_connection_send_with_reply_and_block(bus, m, -1, &error))) {
-                log_error("Failed to issue method call: %s", error.message);
+                log_error("Failed to issue method call: %s", bus_error_message(&error));
                 r = -EIO;
                 goto finish;
         }
@@ -3091,7 +3091,7 @@ static int set_environment(DBusConnection *bus, char **args, unsigned n) {
         }
 
         if (!(reply = dbus_connection_send_with_reply_and_block(bus, m, -1, &error))) {
-                log_error("Failed to issue method call: %s", error.message);
+                log_error("Failed to issue method call: %s", bus_error_message(&error));
                 r = -EIO;
                 goto finish;
         }
@@ -4526,7 +4526,7 @@ static int talk_upstart(void) {
                         goto finish;
                 }
 
-                log_error("Failed to connect to Upstart bus: %s", error.message);
+                log_error("Failed to connect to Upstart bus: %s", bus_error_message(&error));
                 r = -EIO;
                 goto finish;
         }
@@ -4570,7 +4570,7 @@ static int talk_upstart(void) {
                         goto finish;
                 }
 
-                log_error("Failed to issue method call: %s", error.message);
+                log_error("Failed to issue method call: %s", bus_error_message(&error));
                 r = -EIO;
                 goto finish;
         }
diff --git a/src/update-utmp.c b/src/update-utmp.c
index 336594f..644b6df 100644
--- a/src/update-utmp.c
+++ b/src/update-utmp.c
@@ -77,7 +77,7 @@ static usec_t get_startup_time(Context *c) {
         }
 
         if (!(reply = dbus_connection_send_with_reply_and_block(c->bus, m, -1, &error))) {
-                log_error("Failed to send command: %s", error.message);
+                log_error("Failed to send command: %s", bus_error_message(&error));
                 goto finish;
         }
 
@@ -167,7 +167,7 @@ static int get_current_runlevel(Context *c) {
                 if (!dbus_message_get_args(reply, &error,
                                            DBUS_TYPE_OBJECT_PATH, &path,
                                            DBUS_TYPE_INVALID)) {
-                        log_error("Failed to parse reply: %s", error.message);
+                        log_error("Failed to parse reply: %s", bus_error_message(&error));
                         r = -EIO;
                         goto finish;
                 }
@@ -194,7 +194,7 @@ static int get_current_runlevel(Context *c) {
 
                 dbus_message_unref(reply);
                 if (!(reply = dbus_connection_send_with_reply_and_block(c->bus, m, -1, &error))) {
-                        log_error("Failed to send command: %s", error.message);
+                        log_error("Failed to send command: %s", bus_error_message(&error));
                         r = -EIO;
                         goto finish;
                 }
@@ -379,7 +379,7 @@ int main(int argc, char *argv[]) {
 #endif
 
         if (bus_connect(DBUS_BUS_SYSTEM, &c.bus, NULL, &error) < 0) {
-                log_error("Failed to get D-Bus connection: %s", error.message);
+                log_error("Failed to get D-Bus connection: %s", bus_error_message(&error));
                 r = -EIO;
                 goto finish;
         }
commit 50f74deea32476c3e19cda870857782576587d94
Author: Lennart Poettering <lennart at poettering.net>
Date:   Wed Aug 25 19:37:36 2010 +0200

    sd-daemon: drop SCM_CREDENTIALS passing since it is redundant, the kernel fills this in anyway

diff --git a/fixme b/fixme
index 56efcaf..08fa5d4 100644
--- a/fixme
+++ b/fixme
@@ -80,12 +80,18 @@
 
 * add RefuseManualIsolate= (default on?)
 
+* nofail
+
 * add systemctl switch to dump transaction without executing it
 
 * shell wenn fsck im arsch is
 
 * system.conf/session.conf brauch ne man page
 
+* sd-daemon ohne SCM_CREDENTIALS bitte
+
+* exec /sbin/poweroff als PID 1 und shutdown
+
 External:
 
 * make sure MountOnPlug und MountAuto und SwapOnPlug is off in Fedora
diff --git a/src/sd-daemon.c b/src/sd-daemon.c
index 9b4e010..9c23b91 100644
--- a/src/sd-daemon.c
+++ b/src/sd-daemon.c
@@ -332,11 +332,6 @@ int sd_notify(int unset_environment, const char *state) {
         struct msghdr msghdr;
         struct iovec iovec;
         union sockaddr_union sockaddr;
-        struct ucred *ucred;
-        union {
-                struct cmsghdr cmsghdr;
-                uint8_t buf[CMSG_SPACE(sizeof(struct ucred))];
-        } control;
         const char *e;
 
         if (!state) {
@@ -369,16 +364,6 @@ int sd_notify(int unset_environment, const char *state) {
         iovec.iov_base = (char*) state;
         iovec.iov_len = strlen(state);
 
-        memset(&control, 0, sizeof(control));
-        control.cmsghdr.cmsg_level = SOL_SOCKET;
-        control.cmsghdr.cmsg_type = SCM_CREDENTIALS;
-        control.cmsghdr.cmsg_len = CMSG_LEN(sizeof(struct ucred));
-
-        ucred = (struct ucred*) CMSG_DATA(&control.cmsghdr);
-        ucred->pid = getpid();
-        ucred->uid = getuid();
-        ucred->gid = getgid();
-
         memset(&msghdr, 0, sizeof(msghdr));
         msghdr.msg_name = &sockaddr;
         msghdr.msg_namelen = sizeof(sa_family_t) + strlen(e);
@@ -388,8 +373,6 @@ int sd_notify(int unset_environment, const char *state) {
 
         msghdr.msg_iov = &iovec;
         msghdr.msg_iovlen = 1;
-        msghdr.msg_control = &control;
-        msghdr.msg_controllen = control.cmsghdr.cmsg_len;
 
         if (sendmsg(fd, &msghdr, MSG_NOSIGNAL) < 0) {
                 r = -errno;


More information about the systemd-commits mailing list