Mainloop: Avoid polling for an empty set of events
If a main_file was active, but it did not have any handlers set,
it could happen that poll/epoll was called with an empty set of
requested events.
Alas, even in those cases POLLHUP or POLLERR could be delivered,
leading to an endless loop of such events. (Remember that we do not
use the edge-triggered mode of epoll as we want to be compatible
with plain poll semantics in handlers.)
From now on, we avoid this situation by removing the fd from the
poll set temporarily.
Also, this led to a slight unification of code paths.