fd_set *r_fds = NULL;
int max_fd = 0;
int ret;
- struct timeval select_timeout;
+ struct timeval timeout_remaining, select_timeout;
status = g_lock_trylock(ctx, name, lock_type);
if (NT_STATUS_IS_OK(status)) {
}
#endif
+ time_now = timeval_current();
+ timeout_remaining = timeval_until(&time_now, &timeout_end);
select_timeout = timeval_set(60, 0);
+ select_timeout = timeval_min(&select_timeout,
+ &timeout_remaining);
+
ret = sys_select(max_fd + 1, r_fds, NULL, NULL,
&select_timeout);
if (ret == -1) {