diff --git a/util/makedefs.c b/util/makedefs.c index c1d131e8a..2d49842ea 100644 --- a/util/makedefs.c +++ b/util/makedefs.c @@ -392,6 +392,7 @@ do_rumors() /* copy the true rumors */ while (fgets(in_line, sizeof in_line, ifp) != 0) { true_rumor_count++; + /*[if we forced binary output, this would be sufficient]*/ true_rumor_size += strlen(in_line); /* includes newline */ (void) fputs(xcrypt(in_line), tfp); } @@ -399,6 +400,13 @@ do_rumors() false_rumor_offset = ftell(tfp); Fclose(ifp); /* all done with rumors.tru */ + /* the calculated value for true_rumor_count assumes that + a single-byte line terminator is in use; for platforms + which use two byte CR+LF, we need to override that value + [it's much simpler to do so unconditionally, rendering + the loop's accumulation above obsolete] */ + true_rumor_size = false_rumor_offset - true_rumor_offset; + /* process rumors.fal */ Sprintf(infile, DATA_IN_TEMPLATE, RUMOR_FILE); Strcat(infile, ".fal"); @@ -417,6 +425,10 @@ do_rumors() eof_offset = ftell(tfp); Fclose(ifp); /* all done with rumors.fal */ + /* as with true_rumor_count, override the accumulated value in + case stdio converts \n into two byte CR+LF during output */ + false_rumor_size = eof_offset - false_rumor_offset; + /* get ready to transfer the contents of temp file to output file */ Sprintf(in_line, "rewind of \"%s\"", tempfile); if (rewind(tfp) != 0) {