diff options
Diffstat (limited to 'src/libsystemd/sd-bus/bus-kernel.c')
-rw-r--r-- | src/libsystemd/sd-bus/bus-kernel.c | 27 |
1 files changed, 9 insertions, 18 deletions
diff --git a/src/libsystemd/sd-bus/bus-kernel.c b/src/libsystemd/sd-bus/bus-kernel.c index bd829459de..e73a5077b5 100644 --- a/src/libsystemd/sd-bus/bus-kernel.c +++ b/src/libsystemd/sd-bus/bus-kernel.c @@ -1741,30 +1741,21 @@ int bus_kernel_fix_attach_mask(void) { /* By default we don't want any kdbus metadata fields to be * suppressed, hence we reset the kernel mask for it to - * (uint64_t) -1. This is overridable via a kernel command - * line option, however. */ + * (uint64_t) -1. If the module argument was overwritten by + * the kernel cmdline, we leave it as is. */ - r = get_proc_cmdline_key("systemd.kdbus_attach_flags_mask=", &mask); + r = get_proc_cmdline_key("kdbus.attach_flags_mask=", &mask); if (r < 0) return log_warning_errno(r, "Failed to read kernel command line: %m"); - if (mask) { - const char *p = mask; - - if (startswith(p, "0x")) - p += 2; - - if (sscanf(p, "%" PRIx64, &m) != 1) - log_warning("Couldn't parse systemd.kdbus_attach_flags_mask= kernel command line parameter."); + if (r == 0) { + sprintf(buf, "0x%" PRIx64 "\n", m); + r = write_string_file("/sys/module/kdbus/parameters/attach_flags_mask", buf); + if (r < 0) + return log_full_errno(IN_SET(r, -ENOENT, -EROFS) ? LOG_DEBUG : LOG_WARNING, r, + "Failed to write kdbus attach mask: %m"); } - sprintf(buf, "0x%" PRIx64 "\n", m); - r = write_string_file("/sys/module/kdbus/parameters/attach_flags_mask", buf); - if (r < 0) - return log_full_errno( - IN_SET(r, -ENOENT, -EROFS) ? LOG_DEBUG : LOG_WARNING, r, - "Failed to write kdbus attach mask: %m"); - return 0; } |