s3:lib: Allow open_socket_out without a timeout
[samba.git] / source3 / lib / util_sock.c
index e48cdb07ca9a5fdeac62544315bb43befad202ad..0b7029706a6a6928f75cbe745f12652881d1c2e7 100644 (file)
@@ -481,7 +481,8 @@ struct tevent_req *open_socket_out_send(TALLOC_CTX *mem_ctx,
 
        tevent_req_set_cleanup_fn(req, open_socket_out_cleanup);
 
-       if (!tevent_req_set_endtime(
+       if ((timeout != 0) &&
+           !tevent_req_set_endtime(
                    req, ev, timeval_current_ofs_msec(timeout))) {
                tevent_req_oom(req);
                return tevent_req_post(req, ev);