run: ignore bus connection error in acquiring invocation ID (#37763)
This introduce bus_error_is_connection(), and use it where applicable. Then, this makes connection errors in acquiring invocation ID by systemd-run handled gracefully, like we already do other places. Fixes #37675.
This commit is contained in:
@@ -212,6 +212,13 @@ bool bus_error_is_unknown_service(const sd_bus_error *error) {
|
||||
BUS_ERROR_NO_SUCH_UNIT);
|
||||
}
|
||||
|
||||
bool bus_error_is_connection(const sd_bus_error *error) {
|
||||
return sd_bus_error_has_names(error,
|
||||
SD_BUS_ERROR_NO_REPLY,
|
||||
SD_BUS_ERROR_DISCONNECTED,
|
||||
SD_BUS_ERROR_TIMED_OUT);
|
||||
}
|
||||
|
||||
int bus_check_peercred(sd_bus *c) {
|
||||
struct ucred ucred;
|
||||
int fd, r;
|
||||
|
||||
@@ -22,7 +22,9 @@ typedef bool (*check_idle_t)(void *userdata);
|
||||
int bus_event_loop_with_idle(sd_event *e, sd_bus *bus, const char *name, usec_t timeout, check_idle_t check_idle, void *userdata);
|
||||
|
||||
int bus_name_has_owner(sd_bus *c, const char *name, sd_bus_error *error);
|
||||
|
||||
bool bus_error_is_unknown_service(const sd_bus_error *error);
|
||||
bool bus_error_is_connection(const sd_bus_error *error);
|
||||
|
||||
int bus_check_peercred(sd_bus *c);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user