From: Frantisek Sumsal Date: Fri, 3 Mar 2023 11:17:27 +0000 (+0100) Subject: systemctl: explicitly cast the constants to uint64_t X-Git-Tag: v254-rc1~1125 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=c63bfd0884cf20e48befbee49d41f667660a8802;p=thirdparty%2Fsystemd.git systemctl: explicitly cast the constants to uint64_t Otherwise under certain conditions `va_arg()` might get garbage instead of the expected value, i.e.: $ sudo build-o0/systemctl disable asdfasfaf sd_bus_message_appendv: Got uint64_t: 0 Failed to disable unit: Unit file asdfasfaf.service does not exist. $ sudo build-o1/systemctl disable asdfasfaf sd_bus_message_appendv: Got uint64_t: 7954875719681572864 Failed to disable unit: Invalid argument (reproduced on an armv7hl machine) Resolves: #26568 Follow-up to: bf1bea43f15 Related issue: https://github.com/systemd/systemd/pull/14470#discussion_r362893735 --- diff --git a/src/systemctl/systemctl-enable.c b/src/systemctl/systemctl-enable.c index 4ebe5888ac6..a9c6f3a742c 100644 --- a/src/systemctl/systemctl-enable.c +++ b/src/systemctl/systemctl-enable.c @@ -211,7 +211,7 @@ int verb_enable(int argc, char *argv[], void *userdata) { if (send_runtime) { if (streq(method, "DisableUnitFilesWithFlagsAndInstallInfo")) - r = sd_bus_message_append(m, "t", arg_runtime ? UNIT_FILE_RUNTIME : 0); + r = sd_bus_message_append(m, "t", arg_runtime ? (uint64_t) UNIT_FILE_RUNTIME : UINT64_C(0)); else r = sd_bus_message_append(m, "b", arg_runtime); if (r < 0)