]> git.ipfire.org Git - thirdparty/HylaFAX.git/commitdiff
Make sure our pipe FD for reading jobcontrol is non-blocking so our
authorAidan Van Dyk <aidan@ifax.com>
Wed, 3 May 2006 13:24:42 +0000 (13:24 +0000)
committerAidan Van Dyk <aidan@ifax.com>
Wed, 3 May 2006 13:24:42 +0000 (13:24 +0000)
dispatch framework isn't broken.

Remove extra null-padding as noted by Lee.

faxd/Job.c++

index 9b9302dde2dcf468f1b2e30f798fd7ef068353c0..59fc7365fa55f2d1829ef2a3097e947cc994e995 100644 (file)
@@ -59,9 +59,8 @@ JobCtrlHandler::inputReady (int f)
     char data[1024];
     fxAssert(f == fd, "Reading from a FD which is not our own");
     int n;
-    while ((n = Sys::read(fd, data, sizeof(data)-1)) > 0)
+    while ((n = Sys::read(fd, data, sizeof(data))) > 0)
     {
-       data[n] = '\0';
        buf.append(data, n);
     }
     return 0;
@@ -220,6 +219,7 @@ Job::startControl(pid_t p, int fd)
     if (tmp_jci)
        delete tmp_jci;
 
+    fcntl(fd, F_SETFL, fcntl(fd, F_GETFL, 0) | O_NONBLOCK);
     ctrlHandler.fd = fd;
     Dispatcher::instance().link(fd, Dispatcher::ReadMask, &ctrlHandler);
 }