varlink: cleanup use of ERRNO_IS_DISCONNECT()

Given that ERRNO_IS_DISCONNECT() also matches positive values,
make sure this macro is not called with arguments that do not have
errno semantics.

In this case the argument passed to ERRNO_IS_DISCONNECT() is the
value returned by varlink_connect_address() which is not expected to
return any positive values, but let's be consistent anyway and move
the ERRNO_IS_DISCONNECT() invocation to the branch where
the return value is known to be negative.
This commit is contained in:
Dmitry V. Levin
2023-07-28 12:28:35 +00:00
parent 515669c460
commit fa841994dd
+6 -5
View File
@@ -561,12 +561,13 @@ static int manager_varlink_init_user(Manager *m) {
return 0;
r = varlink_connect_address(&link, VARLINK_ADDR_PATH_MANAGED_OOM_USER);
if (r == -ENOENT || ERRNO_IS_DISCONNECT(r)) {
log_debug("systemd-oomd varlink unix socket not found, skipping user manager varlink setup");
return 0;
}
if (r < 0)
if (r < 0) {
if (r == -ENOENT || ERRNO_IS_DISCONNECT(r)) {
log_debug("systemd-oomd varlink unix socket not found, skipping user manager varlink setup");
return 0;
}
return log_error_errno(r, "Failed to connect to %s: %m", VARLINK_ADDR_PATH_MANAGED_OOM_USER);
}
varlink_set_userdata(link, m);