From 52f0abaa13154d4a6d5aa6f8a4b2b6f1f76a9a2f Mon Sep 17 00:00:00 2001 From: Michiel Broek Date: Sun, 16 Oct 2005 12:13:20 +0000 Subject: [PATCH] Some time_t/int conversions --- ChangeLog | 8 ++++++++ mbcico/callstat.c | 4 ++-- mbcico/callstat.h | 2 +- mbtask/callstat.c | 2 +- mbtask/callstat.h | 2 +- mbtask/mbtask.c | 6 +++--- mbtask/taskregs.c | 32 ++++++++++++++++---------------- mbtask/taskregs.h | 4 ++-- 8 files changed, 34 insertions(+), 26 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1b334dc0..a9240333 100644 --- a/ChangeLog +++ b/ChangeLog @@ -4,12 +4,20 @@ $Id$ v0.81.2 14-Oct-2005. + upgrade: + Owners of 64 bits systems should check if all *.sts files in + the outbound are 12 bytes log. If not, stop the whole bbs and + remove all these files. Then start the bbs again. + mbcico: Some time_t/int conversions. mbfido: Some time_t/int conversions. + mbtask: + Some time_t/int conversions. + v0.81.1 09-Oct-2005 - 14-Oct-2005 diff --git a/mbcico/callstat.c b/mbcico/callstat.c index 29a7d0da..284327de 100644 --- a/mbcico/callstat.c +++ b/mbcico/callstat.c @@ -39,7 +39,7 @@ callstat *getstatus(faddr *addr) static callstat cst; FILE *fp; - cst.trytime = 0L; + cst.trytime = 0; cst.tryno = 0; cst.trystat = 0; @@ -82,7 +82,7 @@ void putstatus(faddr *addr, int incr, int sts) if (sts != -1) cst->trystat = sts; - cst->trytime = time(NULL) + j; + cst->trytime = (int)time(NULL) + j; fwrite(cst, sizeof(callstat), 1, fp); fclose(fp); diff --git a/mbcico/callstat.h b/mbcico/callstat.h index 3f68de9d..2530edbe 100644 --- a/mbcico/callstat.h +++ b/mbcico/callstat.h @@ -5,7 +5,7 @@ typedef struct _callstat { - time_t trytime; + int trytime; int tryno; int trystat; } callstat; diff --git a/mbtask/callstat.c b/mbtask/callstat.c index a5527d0b..14b020ba 100644 --- a/mbtask/callstat.c +++ b/mbtask/callstat.c @@ -116,7 +116,7 @@ callstat *getstatus(faddr *addr) static callstat cst; FILE *fp; - cst.trytime = 0L; + cst.trytime = 0; cst.tryno = 0; cst.trystat = 0; diff --git a/mbtask/callstat.h b/mbtask/callstat.h index 83e88e84..9fa8eb7a 100644 --- a/mbtask/callstat.h +++ b/mbtask/callstat.h @@ -5,7 +5,7 @@ typedef struct _callstat { - time_t trytime; + int trytime; int tryno; int trystat; } callstat; diff --git a/mbtask/mbtask.c b/mbtask/mbtask.c index fbaf4776..e6adf98a 100644 --- a/mbtask/mbtask.c +++ b/mbtask/mbtask.c @@ -965,7 +965,7 @@ void start_scheduler(void) strcpy(reginfo[0].prg, "mbtask"); strcpy(reginfo[0].city, "localhost"); strcpy(reginfo[0].doing, "Start"); - reginfo[0].started = time(NULL); + reginfo[0].started = (int)time(NULL); if (nodaemon) printf("reginfo filled\n"); @@ -1143,7 +1143,7 @@ void *scheduler(void) snprintf(doing, 32, "Overload %2.2f", Load); snprintf(reginfo[0].doing, 36, "%s", doing); - reginfo[0].lastcon = time(NULL); + reginfo[0].lastcon = (int)time(NULL); /* * Touch the mbtask.last semafore to prove this daemon @@ -1344,7 +1344,7 @@ void *scheduler(void) * then launch a callprocess for this node. */ if (calllist[call_entry].addr.zone && !calllist[call_entry].calling && - (calllist[call_entry].cst.trytime < now)) { + (calllist[call_entry].cst.trytime < (int)now)) { if ((calllist[call_entry].callmode == CM_INET) && (ipmailers < TCFG.max_tcp) && internet) { found = TRUE; break; diff --git a/mbtask/taskregs.c b/mbtask/taskregs.c index 622f7561..5204dbd2 100644 --- a/mbtask/taskregs.c +++ b/mbtask/taskregs.c @@ -95,8 +95,8 @@ int reg_newcon(char *data) strncpy((char *)®info[retval].prg, prg, 14); strncpy((char *)®info[retval].city, city, 35); strcpy((char *)®info[retval].doing, "-"); - reginfo[retval].started = time(NULL); - reginfo[retval].lastcon = time(NULL); + reginfo[retval].started = (int)time(NULL); + reginfo[retval].lastcon = (int)time(NULL); reginfo[retval].altime = 600; /* @@ -170,7 +170,7 @@ void reg_check(void) /* * Check timeout */ - if ((Now - reginfo[i].lastcon) >= reginfo[i].altime) { + if (((int)Now - reginfo[i].lastcon) >= reginfo[i].altime) { if (reginfo[i].altime < 600) { kill(reginfo[i].pid, SIGKILL); Syslog('+', "Send SIGKILL to pid %d", reginfo[i].pid); @@ -182,7 +182,7 @@ void reg_check(void) * 10 seconds to the next kill */ reginfo[i].altime = 10; - reginfo[i].lastcon = time(NULL); + reginfo[i].lastcon = (int)time(NULL); } } } @@ -207,7 +207,7 @@ int reg_doing(char *data) return -1; strncpy(reginfo[rec].doing, line, 35); - reginfo[rec].lastcon = time(NULL); + reginfo[rec].lastcon = (int)time(NULL); return 0; } @@ -228,7 +228,7 @@ int reg_ip(char *data) return -1; reginfo[rec].istcp = TRUE; - reginfo[rec].lastcon = time(NULL); + reginfo[rec].lastcon = (int)time(NULL); ipmailers++; Syslog('?', "TCP/IP session registered (%s), now %d sessions", pid, ipmailers); return 0; @@ -249,7 +249,7 @@ int reg_nop(char *data) if ((rec = reg_find(pid)) == -1) return -1; - reginfo[rec].lastcon = time(NULL); + reginfo[rec].lastcon = (int)time(NULL); return 0; } @@ -282,7 +282,7 @@ int reg_timer(int Set, char *data) return -1; reginfo[rec].altime = val; - reginfo[rec].lastcon = time(NULL); + reginfo[rec].lastcon = (int)time(NULL); Syslog('r', "Set timeout value for %d to %d", reginfo[rec].pid, val); return 0; } @@ -305,7 +305,7 @@ int reg_tty(char *data) return -1; strncpy((char *)®info[rec].tty, tty, 6); - reginfo[rec].lastcon = time(NULL); + reginfo[rec].lastcon = (int)time(NULL); return 0; } @@ -327,7 +327,7 @@ int reg_silent(char *data) return -1; reginfo[rec].silent = atoi(line); - reginfo[rec].lastcon = time(NULL); + reginfo[rec].lastcon = (int)time(NULL); return 0; } @@ -351,7 +351,7 @@ int reg_user(char *data) strncpy((char *)®info[rec].uname, user, 35); strncpy((char *)®info[rec].city, city, 35); - reginfo[rec].lastcon = time(NULL); + reginfo[rec].lastcon = (int)time(NULL); return 0; } @@ -370,7 +370,7 @@ int reg_sysop(char *data) sysop_present = atoi(strtok(NULL, ";")); if ((rec = reg_find(pid)) != -1) { - reginfo[rec].lastcon = time(NULL); + reginfo[rec].lastcon = (int)time(NULL); } Syslog('+', "Sysop present for chat: %s", sysop_present ? "True":"False"); @@ -396,7 +396,7 @@ char *reg_ipm(char *data) if ((rec = reg_find(pid)) == -1) return buf; - reginfo[rec].lastcon = time(NULL); + reginfo[rec].lastcon = (int)time(NULL); if (!reginfo[rec].ismsg) return buf; @@ -546,7 +546,7 @@ char *get_reginfo(int first) reginfo[entrypos].pid, reginfo[entrypos].tty, reginfo[entrypos].uname, reginfo[entrypos].prg, reginfo[entrypos].city, reginfo[entrypos].doing, - (int)reginfo[entrypos].started); + reginfo[entrypos].started); return buf; } } @@ -590,7 +590,7 @@ int reg_page(char *data) */ reginfo[rec].paging = TRUE; strncpy(reginfo[rec].reason, reason, 80); - reginfo[rec].lastcon = time(NULL); + reginfo[rec].lastcon = (int)time(NULL); return 0; } @@ -616,7 +616,7 @@ int reg_cancel(char *data) reginfo[rec].paging = FALSE; reginfo[rec].haspaged = TRUE; } - reginfo[rec].lastcon = time(NULL); + reginfo[rec].lastcon = (int)time(NULL); return 0; } diff --git a/mbtask/taskregs.h b/mbtask/taskregs.h index f736f760..f8153470 100644 --- a/mbtask/taskregs.h +++ b/mbtask/taskregs.h @@ -19,8 +19,8 @@ typedef struct _reg_info { char prg[15]; /* Program name */ char city[36]; /* Users city */ char doing[36]; /* What is going on */ - time_t started; /* Startime connection */ - time_t lastcon; /* Last connection */ + int started; /* Startime connection */ + int lastcon; /* Last connection */ int altime; /* Alarm time */ unsigned silent : 1; /* Do not disturb */ unsigned ismsg : 1; /* Message waiting */