From 5043ec64766de6d97b692e94874a4658ff46df00 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Thu, 30 May 2019 22:56:03 +0200 Subject: [PATCH] networkd: shorter two error statements a bit Also let's not use a cast if we don't have to. --- src/network/netdev/macsec.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/network/netdev/macsec.c b/src/network/netdev/macsec.c index 740d8853395..a4967e817bc 100644 --- a/src/network/netdev/macsec.c +++ b/src/network/netdev/macsec.c @@ -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); -- 2.39.2