From: Lee Howard Date: Mon, 7 Feb 2005 16:51:51 +0000 (+0000) Subject: Bug 232: fix RNR/RR loop or hang in faxgetty when decoding pipe fails X-Git-Tag: HYLAFAX-4_2_2BETA1~103 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c6b3384b6d7de13d4b37a91f6b7adeea048c1909;p=thirdparty%2FHylaFAX.git Bug 232: fix RNR/RR loop or hang in faxgetty when decoding pipe fails --- diff --git a/CHANGES b/CHANGES index 95862733..c83abaed 100644 --- 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 diff --git a/faxd/CopyQuality.c++ b/faxd/CopyQuality.c++ index 97f8bcdc..d98eb3d2 100644 --- a/faxd/CopyQuality.c++ +++ b/faxd/CopyQuality.c++ @@ -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);