s3:events: always run_events() before sys_select()
authorStefan Metzmacher <metze@samba.org>
Tue, 20 Jan 2009 00:58:04 +0000 (01:58 +0100)
committerStefan Metzmacher <metze@samba.org>
Thu, 22 Jan 2009 11:37:28 +0000 (12:37 +0100)
We might have pending signal events not only timed events.

metze

source3/lib/events.c

index 74f30a709abdd313d9af89ef97d626fa2b3fbedd..4484d5323bcc3bd5b86c24cf14b5c5d39015a3c6 100644 (file)
@@ -180,17 +180,16 @@ static int s3_event_loop_once(struct tevent_context *ev)
        to.tv_sec = 9999;       /* Max timeout */
        to.tv_usec = 0;
 
+       if (run_events(ev, 0, NULL, NULL)) {
+               return 0;
+       }
+
        GetTimeOfDay(&now);
 
        if (!event_add_to_select_args(ev, &now, &r_fds, &w_fds, &to, &maxfd)) {
                return -1;
        }
 
-       if (timeval_is_zero(&to)) {
-               run_events(ev, 0, NULL, NULL);
-               return 0;
-       }
-
        ret = sys_select(maxfd+1, &r_fds, &w_fds, NULL, &to);
 
        if (ret == -1 && errno != EINTR) {