]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
pam_systemd: reduce append_session_cg_weight() indentation level a bit by moving...
authorLennart Poettering <lennart@poettering.net>
Fri, 20 Jul 2018 09:41:17 +0000 (11:41 +0200)
committerLennart Poettering <lennart@poettering.net>
Wed, 25 Jul 2018 14:09:33 +0000 (16:09 +0200)
src/login/pam_systemd.c

index 91802439e998215eee6fd6e3fb0072d50c341e5a..79a8b2210296fa329eaf284cdbf83ee5f85f3606 100644 (file)
@@ -252,19 +252,20 @@ static int append_session_cg_weight(pam_handle_t *handle, sd_bus_message *m, con
         uint64_t val;
         int r;
 
-        if (!isempty(limit)) {
-                r = cg_weight_parse(limit, &val);
-                if (r >= 0) {
-                        r = sd_bus_message_append(m, "(sv)", field, "t", val);
-                        if (r < 0) {
-                                pam_syslog(handle, LOG_ERR, "Failed to append to bus message: %s", strerror(-r));
-                                return r;
-                        }
-                } else if (streq(field, "CPUWeight"))
-                        pam_syslog(handle, LOG_WARNING, "Failed to parse systemd.cpu_weight: %s, ignoring.", limit);
-                else
-                        pam_syslog(handle, LOG_WARNING, "Failed to parse systemd.io_weight: %s, ignoring.", limit);
-        }
+        if (isempty(limit))
+                return 0;
+
+        r = cg_weight_parse(limit, &val);
+        if (r >= 0) {
+                r = sd_bus_message_append(m, "(sv)", field, "t", val);
+                if (r < 0) {
+                        pam_syslog(handle, LOG_ERR, "Failed to append to bus message: %s", strerror(-r));
+                        return r;
+                }
+        } else if (streq(field, "CPUWeight"))
+                pam_syslog(handle, LOG_WARNING, "Failed to parse systemd.cpu_weight: %s, ignoring.", limit);
+        else
+                pam_syslog(handle, LOG_WARNING, "Failed to parse systemd.io_weight: %s, ignoring.", limit);
 
         return 0;
 }