From 6e8547d7f170d753a7bfe695f643619b0ad83fb9 Mon Sep 17 00:00:00 2001 From: Michiel Broek Date: Mon, 23 Jan 2006 15:40:21 +0000 Subject: [PATCH] Endian fixes --- mbsebbs/offline.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/mbsebbs/offline.c b/mbsebbs/offline.c index 4242c33d..6b7552fe 100644 --- a/mbsebbs/offline.c +++ b/mbsebbs/offline.c @@ -1808,7 +1808,7 @@ unsigned int BlueWave_PackArea(unsigned int ulLast, int Area) MIX_REC Mix; FTI_REC Fti; struct tm *tp; - int Pack; + int Pack, length; Number = ulLast; Temp = calloc(PATH_MAX, sizeof(char)); @@ -1819,9 +1819,11 @@ unsigned int BlueWave_PackArea(unsigned int ulLast, int Area) snprintf(Temp, PATH_MAX, "%s/%s/tmp/%s.MIX", CFG.bbs_usersdir, exitinfo.Name, CFG.bbsid); fdmix = fopen(Temp, "a+"); + fseek(fdmix, 0, SEEK_END); snprintf(Temp, PATH_MAX, "%s/%s/tmp/%s.DAT", CFG.bbs_usersdir, exitinfo.Name, CFG.bbsid); fdm = fopen(Temp, "a+"); + fseek(fdm, 0, SEEK_END); memset(&Mix, 0, sizeof(MIX_REC)); snprintf((char *)Mix.areanum, 6, "%u", Area); @@ -1859,7 +1861,7 @@ unsigned int BlueWave_PackArea(unsigned int ulLast, int Area) snprintf((char *)Fti.date, 20, "%2d %.3s %2d %2d:%02d:%02d", tp->tm_mday, (char *) Language(398 + tp->tm_mon), tp->tm_year, tp->tm_hour, tp->tm_min, tp->tm_sec); Fti.msgnum = le_us((tWORD)Number); - Fti.msgptr = le_us((tLONG)ftell(fdm)); + Fti.msgptr = le_int((tLONG)ftell(fdm)); Fti.replyto = le_us((tWORD)Msg.Original); Fti.replyat = le_us((tWORD)Msg.Reply); if (msgs.Type == NETMAIL) { @@ -1868,17 +1870,18 @@ unsigned int BlueWave_PackArea(unsigned int ulLast, int Area) Fti.orig_node = le_us(msgs.Aka.node); } - Fti.msglength += fwrite(" ", 1, 1, fdm); + length = (int)fwrite(" ", 1, 1, fdm); if ((Text = (char *)MsgText_First()) != NULL) { do { if ((Text[0] != 0x01) || (strncmp(Text, "\001MSGID", 6) == 0) || ((strncmp(Text, "\001FMPT ", 6) == 0) && (msgs.Type == NETMAIL)) || (exitinfo.OL_ExtInfo)) { - Fti.msglength += fwrite(Text, 1, strlen(Text), fdm); - Fti.msglength += fwrite("\r\n", 1, 2, fdm); + length += fwrite(Text, 1, strlen(Text), fdm); + length += fwrite("\r\n", 1, 2, fdm); } } while ((Text = (char *)MsgText_Next()) != NULL); + Fti.msglength = le_int(length); fwrite(&Fti, sizeof (Fti), 1, fdfti); } }