networkd: shorter two error statements a bit

Also let's not use a cast if we don't have to.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2019-05-30 22:56:03 +02:00
parent 3135369cff
commit 5043ec6476
+5 -7
View 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);