From: Aki Tuomi Date: Mon, 9 Dec 2013 11:37:16 +0000 (+0200) Subject: Align with pipebackend as per #1137 and #661 X-Git-Tag: rec-3.6.0-rc1~308^2~1 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=c9913bddcd4174eb733706bf841cd66ceb2b46f2;p=thirdparty%2Fpdns.git Align with pipebackend as per #1137 and #661 --- diff --git a/modules/remotebackend/pipeconnector.cc b/modules/remotebackend/pipeconnector.cc index 36cf3110ce..0f8b1b91a4 100644 --- a/modules/remotebackend/pipeconnector.cc +++ b/modules/remotebackend/pipeconnector.cc @@ -64,7 +64,8 @@ void PipeConnector::launch() { Utility::setCloseOnExec(d_fd2[0]); if(!(d_fp=fdopen(d_fd2[0],"r"))) throw PDNSException("Unable to associate a file pointer with pipe: "+stringerror()); - setbuf(d_fp,0); // no buffering please, confuses select + if (d_timeout) + setbuf(d_fp,0); // no buffering please, confuses select } else if(!d_pid) { // child signal(SIGCHLD, SIG_DFL); // silence a warning from perl @@ -144,8 +145,12 @@ int PipeConnector::recv_message(rapidjson::Document &output) receive.clear(); if(d_timeout) { struct timeval tv; - tv.tv_sec = d_timeout/1000; - tv.tv_usec = (d_timeout % 1000) * 1000; + if (d_timeout) { + tv.tv_sec = d_timeout/1000; + tv.tv_usec = (d_timeout % 1000) * 1000; + } else { + memset(&tv,0,sizeof tv); // ensure + } fd_set rds; FD_ZERO(&rds); FD_SET(fileno(d_fp),&rds);