]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
dbus-util: let's take it down a notch when converting file mode to string
authorFrantisek Sumsal <frantisek@sumsal.cz>
Thu, 1 Jun 2023 18:22:20 +0000 (20:22 +0200)
committerFrantisek Sumsal <frantisek@sumsal.cz>
Thu, 1 Jun 2023 18:33:17 +0000 (20:33 +0200)
I'm definitely a fan of precision, but in this case it's a bit too much:

    $ systemd-run --unit=test --socket-property=ListenFIFO=/tmp/foo --socket-property=SocketMode=0644 true
    $ systemctl cat test.socket
    # /run/systemd/transient/test.socket
    # This is a transient unit file, created programmatically via the systemd API. Do not edit.
    [Unit]
    Description=/usr/bin/true

    [Socket]
    ListenFIFO=/tmp/foo
    SocketMode=0000000000000000000000000000000000000644

src/core/dbus-util.c

index 461f6aafb22883d0aba5c4317dbaab0f30f56b47..e891cef1efdcc381e00a105b9e50b5e6aa49b59f 100644 (file)
@@ -30,7 +30,7 @@ int bus_property_get_triggered_unit(
         return sd_bus_message_append(reply, "s", trigger ? trigger->id : NULL);
 }
 
-BUS_DEFINE_SET_TRANSIENT(mode_t, "u", uint32_t, mode_t, "%040o");
+BUS_DEFINE_SET_TRANSIENT(mode_t, "u", uint32_t, mode_t, "%04o");
 BUS_DEFINE_SET_TRANSIENT(unsigned, "u", uint32_t, unsigned, "%" PRIu32);
 
 static inline bool valid_user_group_name_or_id_relaxed(const char *u) {