chiark / gitweb /
treewide: auto-convert the simple cases to log_*_errno()
[elogind.git] / src / libsystemd / sd-bus / bus-kernel.c
index 759d566eb31d9fc4d3c8a7fb33bcc3802a9c9310..fe150ccdae82e6b30b240c472821325cabaa7d0c 100644 (file)
@@ -1059,7 +1059,7 @@ int bus_kernel_write_message(sd_bus *bus, sd_bus_message *m, bool hint_sync_call
 
                                 /* Anybody can send us invalid messages, let's just drop them. */
                                 if (r == -EBADMSG || r == -EPROTOTYPE)
-                                        log_debug("Ignoring invalid message: %s", strerror(-r));
+                                        log_debug_errno(-r, "Ignoring invalid message: %m");
                                 else
                                         return r;
                         }
@@ -1243,7 +1243,7 @@ int bus_kernel_read_message(sd_bus *bus, bool hint_priority, int64_t priority) {
 
                 /* Anybody can send us invalid messages, let's just drop them. */
                 if (r == -EBADMSG || r == -EPROTOTYPE) {
-                        log_debug("Ignoring invalid message: %s", strerror(-r));
+                        log_debug_errno(-r, "Ignoring invalid message: %m");
                         r = 0;
                 }
 
@@ -1800,15 +1800,18 @@ int bus_kernel_realize_attach_flags(sd_bus *bus) {
 
 int bus_kernel_fix_attach_mask(void) {
         _cleanup_free_ char *mask = NULL;
-        uint64_t m = (uint32_t) -1;
+        uint64_t m = (uint64_t) -1;
         char buf[2+16+2];
         int r;
 
+        /* 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. */
+
         r = get_proc_cmdline_key("systemd.kdbus_attach_flags_mask=", &mask);
-        if (r < 0) {
-                log_warning_errno(-r, "Failed to read kernel command line: %m");
-                return r;
-        }
+        if (r < 0)
+                return log_warning_errno(r, "Failed to read kernel command line: %m");
 
         if (mask) {
                 const char *p = mask;
@@ -1822,10 +1825,10 @@ int bus_kernel_fix_attach_mask(void) {
 
         sprintf(buf, "0x%" PRIx64 "\n", m);
         r = write_string_file("/sys/module/kdbus/parameters/attach_flags_mask", buf);
-        if (r < 0) {
-                log_warning_errno(-r, "Failed to write kdbus attach mask: %m");
-                return r;
-        }
+        if (r < 0)
+                return log_full_errno(
+                                r == -EROFS ? LOG_DEBUG : LOG_WARNING, r,
+                                "Failed to write kdbus attach mask: %m");
 
         return 0;
 }