From 23f4730614255af0310610c3e0977e1b0aa5e949 Mon Sep 17 00:00:00 2001 From: Michiel Broek Date: Fri, 30 Mar 2007 19:17:36 +0000 Subject: [PATCH] Fixed CRC error created by last mbdiff change --- ChangeLog | 1 + mbfido/mbdiff.c | 30 ++++++++++++++++++++++-------- 2 files changed, 23 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index 71b86c65..de0f2e9e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -28,6 +28,7 @@ v0.91.7 07-Mar-2007 mbdiff: Wrote a lf instead of eof character as last character in the new nodelist. + Fixed CRC error made by previous change. mbnntp: Suppress logging of passwords. diff --git a/mbfido/mbdiff.c b/mbfido/mbdiff.c index 9ae01a8b..30c1c7b4 100644 --- a/mbfido/mbdiff.c +++ b/mbfido/mbdiff.c @@ -482,6 +482,7 @@ int apply(char *nl, char *nd, char *nn) while ((rc == 0) && fgets(cmdbuf, sizeof(cmdbuf)-1, fd)) { switch (cmdbuf[0]) { + case '\032': break; case ';': Striplf(cmdbuf); break; case 'A': count = atoi(cmdbuf+1); @@ -514,9 +515,14 @@ int apply(char *nl, char *nd, char *nn) Striplf(cmdbuf); for (i = 0; (i < count) && (rc == 0); i++) if (fgets(lnbuf, sizeof(lnbuf) - 1, fo)) { - for (p = lnbuf; *p; p++) - mycrc = updcrc(*p, mycrc); - fputs(lnbuf, fn); + /* + * Don't use EOF character for CRC test. + */ + if (lnbuf[0] != '\032') { + for (p = lnbuf; *p; p++) + mycrc = updcrc(*p, mycrc); + fputs(lnbuf, fn); + } } else rc = 3; break; @@ -539,15 +545,23 @@ int apply(char *nl, char *nd, char *nn) if ((rc == 0) && (mycrc != theircrc)) rc = 4; - if (rc == 3) + if (rc == 3) { WriteError("Could not read some of the files"); - else if (rc == 4) + if (!do_quiet) + printf("Could not read some of the files\n"); + } else if (rc == 4) { WriteError("CRC is %hu, should be %hu", mycrc, theircrc); - else if (rc == 5) + if (!do_quiet) + printf("CRC is %hu, should be %hu\n", mycrc, theircrc); + } else if (rc == 5) { WriteError("Unknown input line: \"%s\"", cmdbuf); - else if (rc == 6) + if (!do_quiet) + printf("Unknown input line: \"%s\"\n", cmdbuf); + } else if (rc == 6) { WriteError("Diff does not match old list"); - else { + if (!do_quiet) + printf("Diff does not match old list\n"); + } else { Syslog('+', "Copied %d, added %d, deleted %d, difference %d", cc, ac, dc, ac-dc); if (!do_quiet) printf("Created new nodelist\n");