cookie in batcher.c

KIZU takashi kizu at ics.es.osaka-u.ac.jp
Thu Sep 9 15:01:00 UTC 1999


	Dear sirs,

I'm afraid that the variable `Cookie' on backends/batcher.c. has
something wrong.

If any batch file is not opend yet and some kind of signals is
trapped, the function RequeueAndExit(-1, NULL, 0L) will be called and
the top line in a queue file will be lost.

If (BytesInBatch > 0 && BytesInCB + BytesInArt >= BytesInBatch) and
(MaxBytes > 0 BytesWritten + BytesInArt >= MaxBytes), then `while
(fgets...)' loop is breaked. But the function BATCHclose(F) usually
returns 0. Hence `Cookie' is ignored in the function RequeueAndExit().

I try to make a patch against this problem. I hope it will be help
you.

Sincerely yours.

- Osaka Univ. Japan.
- Kizu, Takashi	kizu at ics.es.osaka-u.ac.jp


-- Attached file included as plaintext by Listar --
-- Desc: patch_for_batcher

*** batcher.c.orig	Wed Oct 14 08:17:48 1998
--- batcher.c	Thu Sep  9 19:30:12 1999
***************
*** 131,137 ****
--- 131,139 ----
  	    exit(0);
  	}
  	/* Don't seek back -- batch was fine. */
+ #if 0
  	Cookie = -1;
+ #endif
      }
  
      /* Make an appropriate spool file. */
***************
*** 337,342 ****
--- 339,347 ----
  	/* Record line length in case we do an ftell. Not portable to
  	 * systems with non-Unix file formats. */
  	length = strlen(line);
+ #if 1
+ 	Cookie = ftell(stdin) - length;
+ #endif
  
  	/* Get lines like "name size" */
  	if ((p = strchr(line, '\n')) == NULL) {
***************
*** 436,442 ****
--- 441,449 ----
  		BytesInCB += strlen(InitialString) + 1;
  		BytesWritten += strlen(InitialString) + 1;
  	    }
+ #if 0
  	    Cookie = ftell(stdin) - length;
+ #endif
  	    goto SendIt;
  	}
  
***************
*** 476,482 ****
--- 483,493 ----
  		    QIOclose(qp);
  		else
  		    (void)close(artfd);
+ #if 0
  		RequeueAndExit(Cookie, line, BytesInArt);
+ #else
+ 		RequeueAndExit(Cookie, (char *)NULL, 0L);
+ #endif
  	    }
  
  	    if ((F = BATCHstart()) == NULL) {
***************
*** 488,494 ****
--- 499,507 ----
  		    (void)close(artfd);
  		break;
  	    }
+ #if 0
  	    Cookie = ftell(stdin) - length;
+ #endif
  	}
  
      SendIt:
***************
*** 540,545 ****
--- 553,561 ----
  	BytesWritten += BytesInArt;
  	ArtsInCB++;
  	ArtsWritten++;
+ #if 1
+ 	Cookie = ftell(stdin);
+ #endif
  
  	if (GotInterrupt) {
  	    BATCHstatus = BATCHclose(F);




More information about the inn-bugs mailing list