From: Frantisek Sumsal Date: Thu, 1 Jun 2023 18:22:20 +0000 (+0200) Subject: dbus-util: let's take it down a notch when converting file mode to string X-Git-Tag: v254-rc1~304^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b86ed7f710b89b7a7e36da158c1bb8c69ffed144;p=thirdparty%2Fsystemd.git dbus-util: let's take it down a notch when converting file mode to string 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 --- diff --git a/src/core/dbus-util.c b/src/core/dbus-util.c index 461f6aafb22..e891cef1efd 100644 --- a/src/core/dbus-util.c +++ b/src/core/dbus-util.c @@ -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) {