X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=src%2Flibsystemd-bus%2Fsd-event.c;h=0317088af31b73b59d84345968df5518f206faf0;hp=727528bb3cc84e839e3c180d1812497165c159ec;hb=f98a58fe894d34e4d9675757180f34a8523c936e;hpb=ec202eae8e84a4c99f054f771cb832046cb8769f diff --git a/src/libsystemd-bus/sd-event.c b/src/libsystemd-bus/sd-event.c index 727528bb3..0317088af 100644 --- a/src/libsystemd-bus/sd-event.c +++ b/src/libsystemd-bus/sd-event.c @@ -1986,7 +1986,7 @@ _public_ int sd_event_run(sd_event *e, uint64_t timeout) { m = epoll_wait(e->epoll_fd, ev_queue, ev_queue_max, timeout == (uint64_t) -1 ? -1 : (int) ((timeout + USEC_PER_MSEC - 1) / USEC_PER_MSEC)); if (m < 0) { - r = errno == EAGAIN || errno == EINTR ? 0 : -errno; + r = errno == EAGAIN || errno == EINTR ? 1 : -errno; goto finish; } @@ -2029,7 +2029,7 @@ _public_ int sd_event_run(sd_event *e, uint64_t timeout) { p = event_next_pending(e); if (!p) { - r = 0; + r = 1; goto finish; } @@ -2164,17 +2164,10 @@ _public_ int sd_event_set_watchdog(sd_event *e, int b) { if (b) { struct epoll_event ev = {}; - const char *env; - env = getenv("WATCHDOG_USEC"); - if (!env) - return false; - - r = safe_atou64(env, &e->watchdog_period); - if (r < 0) + r = sd_watchdog_enabled(false, &e->watchdog_period); + if (r <= 0) return r; - if (e->watchdog_period <= 0) - return -EIO; /* Issue first ping immediately */ sd_notify(false, "WATCHDOG=1");