Fixed LR pointers in JAM pack for FreeBSD

This commit is contained in:
Michiel Broek 2002-05-18 11:54:42 +00:00
parent 41f7ef2426
commit 036b33e44b
2 changed files with 7 additions and 10 deletions

View File

@ -4631,6 +4631,8 @@ v0.33.20 10-Feb-2002
msgbase.a: msgbase.a:
Improved logging for opening message bases. Improved logging for opening message bases.
Added function to delete a JAM message base. 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: mbsetup:
In message groups added default settings for auto area In message groups added default settings for auto area

View File

@ -586,7 +586,7 @@ int JAM_Open(char *Msgbase)
/* /*
* Pack deleted messages from the message base. The messages are * 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) void JAM_Pack(void)
{ {
@ -642,7 +642,8 @@ void JAM_Pack(void)
Written++; Written++;
lseek(fdJlr, 0, SEEK_SET); 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 * Test if one of the lastread pointer is the current
* old message number. * old message number.
@ -655,9 +656,8 @@ void JAM_Pack(void)
LR.LastReadMsg = NewNumber; LR.LastReadMsg = NewNumber;
if (LR.HighReadMsg == jamHdr.MsgNum) if (LR.HighReadMsg == jamHdr.MsgNum)
LR.HighReadMsg = NewNumber; LR.HighReadMsg = NewNumber;
lseek(fdJlr, - sizeof(lastread), SEEK_CUR);
write(fdJlr, &LR, sizeof(lastread));
} }
write(fdnJlr, &LR, sizeof(lastread));
} }
jamHdr.MsgNum = NewNumber; jamHdr.MsgNum = NewNumber;
write(fdnHdr, &jamHdr, sizeof(JAMHDR)); 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(fdnHdr);
close(fdnJdt); close(fdnJdt);
close(fdnJdx); close(fdnJdx);