diff --git a/src/util/vireventpoll.c b/src/util/vireventpoll.c index 13d278df13..2fe58c7c12 100644 --- a/src/util/vireventpoll.c +++ b/src/util/vireventpoll.c @@ -643,6 +643,12 @@ int virEventPollRunOnce(void) EVENT_DEBUG("Poll got error event %d", errno); if (errno == EINTR || errno == EAGAIN) goto retry; +#ifdef __APPLE__ + if (errno == EBADF) { + virMutexLock(&eventLoop.lock); + goto cleanup; + } +#endif virReportSystemError(errno, "%s", _("Unable to poll on file handles")); return -1; @@ -660,6 +666,9 @@ int virEventPollRunOnce(void) virEventPollCleanupTimeouts(); virEventPollCleanupHandles(); +#ifdef __APPLE__ + cleanup: +#endif eventLoop.running = 0; virMutexUnlock(&eventLoop.lock); return 0;