]> git.ipfire.org Git - thirdparty/HylaFAX.git/commitdiff
Bug 232: fix RNR/RR loop or hang in faxgetty when decoding pipe fails
authorLee Howard <faxguy@howardsilvan.com>
Mon, 7 Feb 2005 16:51:51 +0000 (16:51 +0000)
committerLee Howard <faxguy@howardsilvan.com>
Mon, 7 Feb 2005 16:51:51 +0000 (16:51 +0000)
CHANGES
faxd/CopyQuality.c++

diff --git a/CHANGES b/CHANGES
index 9586273301050601bf982c439c75423d7e5b0ff5..c83abaed6ec52183f3429c233998a5596d0bd0f0 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -2,6 +2,7 @@
 
 Changelog for HylaFAX
 
+* fix some problems when decoding pipe fails in ECM
 * ignore "echos" of the dialed number after dialing
 * set Class1*WaitCmds in cirrus config to not use +FTS/+FRS
 * improve default modem config file for Digi/Patton Class 1
index 97f8bcdc03ea0ff2ae3171f3381cf9b779790bc5..d98eb3d2ec5fde297e31c4dc170aeba4bcd4797b 100644 (file)
@@ -402,6 +402,7 @@ FaxModem::writeECMData(TIFF* tif, u_char* buf, u_int cc, const Class2Params& par
 
     char cbuf[4];              // size of the page count signal
     if (seq & 1) {             // first block
+       decoderFd[1] = -1;
        initializeDecoder(params);
        setupStartPage(tif, params);
        u_int rowpixels = params.pageWidth();   // NB: assume rowpixels <= 4864
@@ -452,12 +453,14 @@ FaxModem::writeECMData(TIFF* tif, u_char* buf, u_int cc, const Class2Params& par
            recvTrace("Could not open decoding pipe.");
        }
     }
-    for (u_int i = 0; i < cc; i++) {
-       cbuf[0] = 0x00;         // data marker
-       cbuf[1] = buf[i];
-       Sys::write(decoderFd[1], cbuf, 2);
+    if (decoderFd[1] != -1) {          // only if pipe succeeded
+           for (u_int i = 0; i < cc; i++) {
+           cbuf[0] = 0x00;             // data marker
+           cbuf[1] = buf[i];
+           Sys::write(decoderFd[1], cbuf, 2);
+       }
     }
-    if (seq & 2) {             // last block
+    if (decoderFd[1] != -1 && seq & 2) {               // last block
        cbuf[0] = 0xFF;         // this signals...
        cbuf[1] = 0xFF;         // ... end of data
        Sys::write(decoderFd[1], cbuf, 2);