diff options
Diffstat (limited to 'minecproxy/systemd.c')
-rw-r--r-- | minecproxy/systemd.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/minecproxy/systemd.c b/minecproxy/systemd.c index 96ff50f..3351f1c 100644 --- a/minecproxy/systemd.c +++ b/minecproxy/systemd.c @@ -1,6 +1,7 @@ #include <string.h> #include <stdlib.h> #include <systemd/sd-bus.h> +#include <errno.h> #include "main.h" #include "server.h" @@ -58,11 +59,15 @@ bool systemd_service_running(struct server *server) server->scfg.systemd_obj, false); +again: r = sd_bus_get_property_string(bus, SYSTEMD_DBUS_SERVICE, server->scfg.systemd_obj, SYSTEMD_DBUS_INTERFACE, "ActiveState", &error, &status); if (r < 0) { + if (sd_bus_error_get_errno(&error) == EINTR) + goto again; + error("failed to get status for service %s (%s): %s", server->scfg.systemd_service, server->scfg.systemd_obj, error.message); @@ -96,10 +101,14 @@ static bool systemd_service_action(struct server *server, const char *action) server->scfg.systemd_obj && action, false); +again: r = sd_bus_call_method(bus, SYSTEMD_DBUS_SERVICE, server->scfg.systemd_obj, SYSTEMD_DBUS_INTERFACE, action, &error, &m, "s", "fail"); if (r < 0) { + if (sd_bus_error_get_errno(&error) == EINTR) + goto again; + error("failed to perform action %s on systemd service %s: %s", action, server->scfg.systemd_service, error.message); goto out; |