]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
networkd: shorter two error statements a bit
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Thu, 30 May 2019 20:56:03 +0000 (22:56 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Thu, 30 May 2019 20:56:03 +0000 (22:56 +0200)
Also let's not use a cast if we don't have to.

src/network/netdev/macsec.c

index 740d8853395b48514a41cb53d81c1e62487dfa93..a4967e817bcfe0b84472772afa3598288a946b9f 100644 (file)
@@ -852,15 +852,13 @@ int config_parse_macsec_key_id(
 
         r = unhexmem(rvalue, strlen(rvalue), &p, &l);
         if (r < 0) {
-                log_syntax(unit, LOG_ERR, filename, line, r, "Failed to parse key id. Ignoring assignment: %s", rvalue);
-                return 0;
-        }
-        if (l > MACSEC_KEYID_LEN) {
-                log_syntax(unit, LOG_ERR, filename, line, 0,
-                           "The size of key id is too large (%zu), maximum of %zu permitted. "
-                           "Ignoring assignment: %s", l, (size_t) MACSEC_KEYID_LEN, rvalue);
+                log_syntax(unit, LOG_ERR, filename, line, r, "Failed to parse KeyId \"%s\": %m", rvalue);
                 return 0;
         }
+        if (l > MACSEC_KEYID_LEN)
+                return log_syntax(unit, LOG_ERR, filename, line, 0,
+                                  "Specified KeyId is larger then the allowed maximum (%zu > %u), ignoring: %s",
+                                  l, MACSEC_KEYID_LEN, rvalue);
 
         dest = a ? a->sa.key_id : b->sa.key_id;
         memcpy_safe(dest, p, l);