]> git.ipfire.org Git - thirdparty/HylaFAX.git/commitdiff
[Bug 178] Correct file creation sequence from skipping 1
authorDarren Nickerson <darren.nickerson@ifax.com>
Mon, 16 Jul 2001 04:10:35 +0000 (04:10 +0000)
committerDarren Nickerson <darren.nickerson@ifax.com>
Mon, 16 Jul 2001 04:10:35 +0000 (04:10 +0000)
Applied Jeremy's patch

faxd/FaxRecv.c++
faxd/ModemServer.c++

index 2a9fe3a9fedc0d913290bb66247d7154d22a378f..1edbdad5de40f69bacfc4c0c88158cb15020b2e3 100644 (file)
@@ -132,9 +132,9 @@ FaxServer::getRecvFile(fxStr& qfile, fxStr& emsg)
     int ftmp;
     int ntry = 1000;                   // that should be a lot!
     do {
-       seqnum = NEXTSEQNUM(seqnum);
        qfile = fxStr::format(FAX_RECVDIR "/fax%05u.tif", seqnum);
        ftmp = Sys::open(qfile, O_RDWR|O_CREAT|O_EXCL, recvFileMode);
+       seqnum = NEXTSEQNUM(seqnum);    // Increment _after_ attempting to open
     } while (ftmp < 0 && errno == EEXIST && --ntry >= 0);
     if (ftmp >= 0) {
        /*
index 14cbbf6ac9593eb2ba36bef37c41933798013255..da8947b83001a268a2131fa844714cc6b29e767a 100644 (file)
@@ -642,10 +642,10 @@ ModemServer::beginSession(const fxStr& number)
        int ftmp;
        int ntry = 1000;                        // that should be a lot!
        do {
-           seqnum = NEXTSEQNUM(seqnum);
            commid = fxStr::format("%08u", seqnum);
            fxStr file = FAX_LOGDIR "/c" | commid;
            ftmp = Sys::open(file, O_RDWR|O_CREAT|O_EXCL, logMode);
+           seqnum = NEXTSEQNUM(seqnum);        // Increment _after_ attempting to open
        } while (ftmp < 0 && errno == EEXIST && --ntry >= 0);
        umask(omask);
         if (ftmp >= 0) {