tree-wide: clean up log_syntax() usage
- Rely everywhere that we use abs() on the error code passed in anyway, thus don't need to explicitly negate what we pass in - Never attach synthetic error number information to log messages. Only log about errors we *receive* with the error number we got there, don't log any synthetic error, that don#t even propagate, but just eat up. - Be more careful with attaching exactly the error we get, instead of errno or unrelated errors randomly. - Fix one occasion where the error number and line number got swapped. - Make sure we never tape over OOM issues, or inability to resolve specifiers
This commit is contained in:
@@ -196,8 +196,7 @@ int config_parse_ifname(const char *unit,
|
||||
return log_oom();
|
||||
|
||||
if (!ascii_is_valid(n) || strlen(n) >= IFNAMSIZ) {
|
||||
log_syntax(unit, LOG_ERR, filename, line, EINVAL,
|
||||
"Interface name is not ASCII clean or is too long, ignoring assignment: %s", rvalue);
|
||||
log_syntax(unit, LOG_ERR, filename, line, 0, "Interface name is not ASCII clean or is too long, ignoring assignment: %s", rvalue);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -240,8 +239,7 @@ int config_parse_ifnames(const char *unit,
|
||||
return log_oom();
|
||||
|
||||
if (!ascii_is_valid(n) || strlen(n) >= IFNAMSIZ) {
|
||||
log_syntax(unit, LOG_ERR, filename, line, EINVAL,
|
||||
"Interface name is not ASCII clean or is too long, ignoring assignment: %s", rvalue);
|
||||
log_syntax(unit, LOG_ERR, filename, line, 0, "Interface name is not ASCII clean or is too long, ignoring assignment: %s", rvalue);
|
||||
free(n);
|
||||
return 0;
|
||||
}
|
||||
@@ -278,8 +276,7 @@ int config_parse_ifalias(const char *unit,
|
||||
return log_oom();
|
||||
|
||||
if (!ascii_is_valid(n) || strlen(n) >= IFALIASZ) {
|
||||
log_syntax(unit, LOG_ERR, filename, line, EINVAL,
|
||||
"Interface alias is not ASCII clean or is too long, ignoring assignment: %s", rvalue);
|
||||
log_syntax(unit, LOG_ERR, filename, line, 0, "Interface alias is not ASCII clean or is too long, ignoring assignment: %s", rvalue);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -324,8 +321,7 @@ int config_parse_hwaddr(const char *unit,
|
||||
&n->ether_addr_octet[4],
|
||||
&n->ether_addr_octet[5]);
|
||||
if (r != 6) {
|
||||
log_syntax(unit, LOG_ERR, filename, line, EINVAL,
|
||||
"Not a valid MAC address, ignoring assignment: %s", rvalue);
|
||||
log_syntax(unit, LOG_ERR, filename, line, 0, "Not a valid MAC address, ignoring assignment: %s", rvalue);
|
||||
free(n);
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user