HylaFAX The world's most advanced open source fax server

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: List of Outstanding Patches




"Mr. Arlington Hewes" <tpcadmin@info.tpc.int> writes:

> Phil Abercrombie <phil@comp.vuw.ac.nz> reported a potential patch (I 
> don't believe anyone ever commented on it) for:
> 
> Job numbers for outgoing faxes increase sequentially from 1 to 31999
> but then instead of starting again at 0, the next number is 1999 and
> then 200009 after which things settle down again.
> 
> Incorporating that one, should it resurface, would be high on the 
> desirability scale, I would think.

Here's the patch, expanded to handle log/c* and recvq/fax* numbers
too:

--- hfaxd/HylaFAXServer.c++.orig        Thu Sep 25 11:08:52 1997
+++ hfaxd/HylaFAXServer.c++     Thu Sep 25 11:09:57 1997
@@ -532,7 +532,8 @@
     }
     sprintf(line, "%u", NEXTSEQNUM(seqnum+count));
     lseek(fd, 0, SEEK_SET);
-    if (Sys::write(fd, line, strlen(line)) != strlen(line)) {
+    if (Sys::write(fd, line, strlen(line)) != strlen(line) ||
+       ftruncate(fd,strlen(line))) {
        emsg = fxStr::format(
            "Unable update sequence number file %s; write failed.", filename);
        logError("%s: Problem updating sequence number file", filename);
--- faxd/ModemServer.c++.orig   Thu Sep 25 11:12:57 1997
+++ faxd/ModemServer.c++        Thu Sep 25 11:15:48 1997
@@ -588,7 +588,8 @@
        if (ftmp >= 0) {
            sprintf(line, "%u", seqnum);
            (void) lseek(fseqf, 0, SEEK_SET);
-           if (Sys::write(fseqf, line, strlen(line)) != strlen(line))
+           if (Sys::write(fseqf, line, strlen(line)) != strlen(line) ||
+                ftruncate(fseqf,strlen(line)))
                logError("Error writing commid sequence number file");
            Sys::close(fseqf);                  // NB: implicit unlock
            log = new
--- faxd/FaxRecv.c++.orig       Thu Sep 25 11:13:03 1997
+++ faxd/FaxRecv.c++    Thu Sep 25 11:15:29 1997
@@ -141,7 +141,8 @@
        (void) flock(ftmp, LOCK_EX|LOCK_NB);
        sprintf(line, "%u", seqnum);
        (void) lseek(fseqf, 0, SEEK_SET);
-       if (Sys::write(fseqf, line, strlen(line)) != strlen(line)) {
+       if (Sys::write(fseqf, line, strlen(line)) != strlen(line) ||
+            ftruncate(fseqf,strlen(line))) {
            emsg = fxStr::format("error updating %s: %s",
                FAX_RECVSEQF, strerror(errno));
            Sys::unlink(qfile);




Project hosted by iFAX Solutions