mirror of
https://github.com/systemd/systemd-stable.git
synced 2024-12-25 23:21:33 +03:00
service: use parse_errno() for parsing error numbers
Let's always use the same logic when parsing error numbers, i.e. use parse_errno() here too, to unify some code, and tighten the checks a bit. This also allows clients to pass errors as symbolic names. Probably nothing we want to advertise too eagerly (since new daemons generating this on old service managers won't understand), but still pretty useful I think, in particular in scripting languages and such, where the numeric error numbers might not be readily available.
This commit is contained in:
parent
67ca6412ab
commit
2fa40742a4
@ -3458,13 +3458,13 @@ static void service_notify_message(Unit *u, pid_t pid, char **tags, FDSet *fds)
|
||||
if (e) {
|
||||
int status_errno;
|
||||
|
||||
if (safe_atoi(e, &status_errno) < 0 || status_errno < 0)
|
||||
log_unit_warning(u, "Failed to parse ERRNO= field in notification message: %s", e);
|
||||
else {
|
||||
if (s->status_errno != status_errno) {
|
||||
s->status_errno = status_errno;
|
||||
notify_dbus = true;
|
||||
}
|
||||
status_errno = parse_errno(e);
|
||||
if (status_errno < 0)
|
||||
log_unit_warning_errno(u, status_errno,
|
||||
"Failed to parse ERRNO= field in notification message: %s", e);
|
||||
else if (s->status_errno != status_errno) {
|
||||
s->status_errno = status_errno;
|
||||
notify_dbus = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user