diff --git a/ChangeLog b/ChangeLog index 1474c695..3f8a5036 100644 --- a/ChangeLog +++ b/ChangeLog @@ -4631,6 +4631,8 @@ v0.33.20 10-Feb-2002 msgbase.a: Improved logging for opening message bases. Added function to delete a JAM message base. + Changed the handling of the lastread pointers in the JAM pack + function which caused problems on FreeBSD. mbsetup: In message groups added default settings for auto area diff --git a/lib/jammsg.c b/lib/jammsg.c index 01cfa00d..8ba439a3 100644 --- a/lib/jammsg.c +++ b/lib/jammsg.c @@ -586,7 +586,7 @@ int JAM_Open(char *Msgbase) /* * Pack deleted messages from the message base. The messages are - * renumbered on the fly. LR update + * renumbered on the fly and the LastRead pointers are updated. */ void JAM_Pack(void) { @@ -642,7 +642,8 @@ void JAM_Pack(void) Written++; lseek(fdJlr, 0, SEEK_SET); - while (read(fdJlr, &LR, sizeof(lastread)) == sizeof(lastread)) { + lseek(fdnJlr, 0, SEEK_SET); + while ((read(fdJlr, &LR, sizeof(lastread)) == sizeof(lastread))) { /* * Test if one of the lastread pointer is the current * old message number. @@ -655,9 +656,8 @@ void JAM_Pack(void) LR.LastReadMsg = NewNumber; if (LR.HighReadMsg == jamHdr.MsgNum) LR.HighReadMsg = NewNumber; - lseek(fdJlr, - sizeof(lastread), SEEK_CUR); - write(fdJlr, &LR, sizeof(lastread)); } + write(fdnJlr, &LR, sizeof(lastread)); } jamHdr.MsgNum = NewNumber; write(fdnHdr, &jamHdr, sizeof(JAMHDR)); @@ -701,13 +701,8 @@ void JAM_Pack(void) } /* - * Now copy the lastread file + * Close all files */ - - lseek(fdJlr, 0, SEEK_SET); - while (read(fdJlr, &LR, sizeof(lastread)) == sizeof(lastread)) - write(fdnJlr, &LR, sizeof(lastread)); - close(fdnHdr); close(fdnJdt); close(fdnJdx);