Fix one of the valgrind warnings from bug #6814 - Fixes for problems reported by...
authorRoel van Meer <rolek@alt001.com>
Fri, 26 Feb 2010 23:09:33 +0000 (15:09 -0800)
committerKarolin Seeger <kseeger@samba.org>
Thu, 6 May 2010 12:23:31 +0000 (14:23 +0200)
The timeval passed to event_add_to_select_args() must be initialized
as event_add_to_select_args() uses a timeval_min() on this and next_event.
(cherry picked from commit a0254fa053cbaa8689de4f13893c50014085f7c8)

source3/winbindd/winbindd.c
source3/winbindd/winbindd_dual.c

index 147781f2e0aaeff6ee0b790d11685213b8787e02..0443ebfdf2cdb6362f402b3dc05d822305990660 100644 (file)
@@ -1047,6 +1047,15 @@ static void process_loop(void)
                struct timeval now;
                GetTimeOfDay(&now);
 
+                /*
+                * Initialize this high as event_add_to_select_args()
+                * uses a timeval_min() on this and next_event. Fix
+                * from Roel van Meer <rolek@alt001.com>.
+                */
+
+               ev_timeout.tv_sec = 999999;
+               ev_timeout.tv_usec = 0;
+
                event_add_to_select_args(winbind_event_context(), &now,
                                         &r_fds, &w_fds, &ev_timeout, &maxfd);
        }
index be6b1371b0651d0c50342d1348be0ba0f692e4c2..72e5607d3f4c2a261bb7c63ee1c0cacf275d7496 100644 (file)
@@ -1406,6 +1406,14 @@ static bool fork_domain_child(struct winbindd_child *child)
                FD_SET(state.sock, &r_fds);
                maxfd = state.sock;
 
+                /*
+                * Initialize this high as event_add_to_select_args()
+                * uses a timeval_min() on this and next_event. Fix
+                * from Roel van Meer <rolek@alt001.com>.
+                */
+                t.tv_sec = 999999;
+                t.tv_usec = 0;
+
                event_add_to_select_args(winbind_event_context(), &now,
                                         &r_fds, &w_fds, &t, &maxfd);
                tp = get_timed_events_timeout(winbind_event_context(), &t);