Some time_t/int conversions

This commit is contained in:
Michiel Broek 2005-10-16 12:13:20 +00:00
parent eef02cca1a
commit 52f0abaa13
8 changed files with 34 additions and 26 deletions

View File

@ -4,12 +4,20 @@ $Id$
v0.81.2 14-Oct-2005. 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: mbcico:
Some time_t/int conversions. Some time_t/int conversions.
mbfido: mbfido:
Some time_t/int conversions. Some time_t/int conversions.
mbtask:
Some time_t/int conversions.
v0.81.1 09-Oct-2005 - 14-Oct-2005 v0.81.1 09-Oct-2005 - 14-Oct-2005

View File

@ -39,7 +39,7 @@ callstat *getstatus(faddr *addr)
static callstat cst; static callstat cst;
FILE *fp; FILE *fp;
cst.trytime = 0L; cst.trytime = 0;
cst.tryno = 0; cst.tryno = 0;
cst.trystat = 0; cst.trystat = 0;
@ -82,7 +82,7 @@ void putstatus(faddr *addr, int incr, int sts)
if (sts != -1) if (sts != -1)
cst->trystat = sts; cst->trystat = sts;
cst->trytime = time(NULL) + j; cst->trytime = (int)time(NULL) + j;
fwrite(cst, sizeof(callstat), 1, fp); fwrite(cst, sizeof(callstat), 1, fp);
fclose(fp); fclose(fp);

View File

@ -5,7 +5,7 @@
typedef struct _callstat { typedef struct _callstat {
time_t trytime; int trytime;
int tryno; int tryno;
int trystat; int trystat;
} callstat; } callstat;

View File

@ -116,7 +116,7 @@ callstat *getstatus(faddr *addr)
static callstat cst; static callstat cst;
FILE *fp; FILE *fp;
cst.trytime = 0L; cst.trytime = 0;
cst.tryno = 0; cst.tryno = 0;
cst.trystat = 0; cst.trystat = 0;

View File

@ -5,7 +5,7 @@
typedef struct _callstat { typedef struct _callstat {
time_t trytime; int trytime;
int tryno; int tryno;
int trystat; int trystat;
} callstat; } callstat;

View File

@ -965,7 +965,7 @@ void start_scheduler(void)
strcpy(reginfo[0].prg, "mbtask"); strcpy(reginfo[0].prg, "mbtask");
strcpy(reginfo[0].city, "localhost"); strcpy(reginfo[0].city, "localhost");
strcpy(reginfo[0].doing, "Start"); strcpy(reginfo[0].doing, "Start");
reginfo[0].started = time(NULL); reginfo[0].started = (int)time(NULL);
if (nodaemon) if (nodaemon)
printf("reginfo filled\n"); printf("reginfo filled\n");
@ -1143,7 +1143,7 @@ void *scheduler(void)
snprintf(doing, 32, "Overload %2.2f", Load); snprintf(doing, 32, "Overload %2.2f", Load);
snprintf(reginfo[0].doing, 36, "%s", doing); 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 * Touch the mbtask.last semafore to prove this daemon
@ -1344,7 +1344,7 @@ void *scheduler(void)
* then launch a callprocess for this node. * then launch a callprocess for this node.
*/ */
if (calllist[call_entry].addr.zone && !calllist[call_entry].calling && 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) { if ((calllist[call_entry].callmode == CM_INET) && (ipmailers < TCFG.max_tcp) && internet) {
found = TRUE; found = TRUE;
break; break;

View File

@ -95,8 +95,8 @@ int reg_newcon(char *data)
strncpy((char *)&reginfo[retval].prg, prg, 14); strncpy((char *)&reginfo[retval].prg, prg, 14);
strncpy((char *)&reginfo[retval].city, city, 35); strncpy((char *)&reginfo[retval].city, city, 35);
strcpy((char *)&reginfo[retval].doing, "-"); strcpy((char *)&reginfo[retval].doing, "-");
reginfo[retval].started = time(NULL); reginfo[retval].started = (int)time(NULL);
reginfo[retval].lastcon = time(NULL); reginfo[retval].lastcon = (int)time(NULL);
reginfo[retval].altime = 600; reginfo[retval].altime = 600;
/* /*
@ -170,7 +170,7 @@ void reg_check(void)
/* /*
* Check timeout * Check timeout
*/ */
if ((Now - reginfo[i].lastcon) >= reginfo[i].altime) { if (((int)Now - reginfo[i].lastcon) >= reginfo[i].altime) {
if (reginfo[i].altime < 600) { if (reginfo[i].altime < 600) {
kill(reginfo[i].pid, SIGKILL); kill(reginfo[i].pid, SIGKILL);
Syslog('+', "Send SIGKILL to pid %d", reginfo[i].pid); Syslog('+', "Send SIGKILL to pid %d", reginfo[i].pid);
@ -182,7 +182,7 @@ void reg_check(void)
* 10 seconds to the next kill * 10 seconds to the next kill
*/ */
reginfo[i].altime = 10; 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; return -1;
strncpy(reginfo[rec].doing, line, 35); strncpy(reginfo[rec].doing, line, 35);
reginfo[rec].lastcon = time(NULL); reginfo[rec].lastcon = (int)time(NULL);
return 0; return 0;
} }
@ -228,7 +228,7 @@ int reg_ip(char *data)
return -1; return -1;
reginfo[rec].istcp = TRUE; reginfo[rec].istcp = TRUE;
reginfo[rec].lastcon = time(NULL); reginfo[rec].lastcon = (int)time(NULL);
ipmailers++; ipmailers++;
Syslog('?', "TCP/IP session registered (%s), now %d sessions", pid, ipmailers); Syslog('?', "TCP/IP session registered (%s), now %d sessions", pid, ipmailers);
return 0; return 0;
@ -249,7 +249,7 @@ int reg_nop(char *data)
if ((rec = reg_find(pid)) == -1) if ((rec = reg_find(pid)) == -1)
return -1; return -1;
reginfo[rec].lastcon = time(NULL); reginfo[rec].lastcon = (int)time(NULL);
return 0; return 0;
} }
@ -282,7 +282,7 @@ int reg_timer(int Set, char *data)
return -1; return -1;
reginfo[rec].altime = val; 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); Syslog('r', "Set timeout value for %d to %d", reginfo[rec].pid, val);
return 0; return 0;
} }
@ -305,7 +305,7 @@ int reg_tty(char *data)
return -1; return -1;
strncpy((char *)&reginfo[rec].tty, tty, 6); strncpy((char *)&reginfo[rec].tty, tty, 6);
reginfo[rec].lastcon = time(NULL); reginfo[rec].lastcon = (int)time(NULL);
return 0; return 0;
} }
@ -327,7 +327,7 @@ int reg_silent(char *data)
return -1; return -1;
reginfo[rec].silent = atoi(line); reginfo[rec].silent = atoi(line);
reginfo[rec].lastcon = time(NULL); reginfo[rec].lastcon = (int)time(NULL);
return 0; return 0;
} }
@ -351,7 +351,7 @@ int reg_user(char *data)
strncpy((char *)&reginfo[rec].uname, user, 35); strncpy((char *)&reginfo[rec].uname, user, 35);
strncpy((char *)&reginfo[rec].city, city, 35); strncpy((char *)&reginfo[rec].city, city, 35);
reginfo[rec].lastcon = time(NULL); reginfo[rec].lastcon = (int)time(NULL);
return 0; return 0;
} }
@ -370,7 +370,7 @@ int reg_sysop(char *data)
sysop_present = atoi(strtok(NULL, ";")); sysop_present = atoi(strtok(NULL, ";"));
if ((rec = reg_find(pid)) != -1) { 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"); 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) if ((rec = reg_find(pid)) == -1)
return buf; return buf;
reginfo[rec].lastcon = time(NULL); reginfo[rec].lastcon = (int)time(NULL);
if (!reginfo[rec].ismsg) if (!reginfo[rec].ismsg)
return buf; return buf;
@ -546,7 +546,7 @@ char *get_reginfo(int first)
reginfo[entrypos].pid, reginfo[entrypos].tty, reginfo[entrypos].pid, reginfo[entrypos].tty,
reginfo[entrypos].uname, reginfo[entrypos].prg, reginfo[entrypos].uname, reginfo[entrypos].prg,
reginfo[entrypos].city, reginfo[entrypos].doing, reginfo[entrypos].city, reginfo[entrypos].doing,
(int)reginfo[entrypos].started); reginfo[entrypos].started);
return buf; return buf;
} }
} }
@ -590,7 +590,7 @@ int reg_page(char *data)
*/ */
reginfo[rec].paging = TRUE; reginfo[rec].paging = TRUE;
strncpy(reginfo[rec].reason, reason, 80); strncpy(reginfo[rec].reason, reason, 80);
reginfo[rec].lastcon = time(NULL); reginfo[rec].lastcon = (int)time(NULL);
return 0; return 0;
} }
@ -616,7 +616,7 @@ int reg_cancel(char *data)
reginfo[rec].paging = FALSE; reginfo[rec].paging = FALSE;
reginfo[rec].haspaged = TRUE; reginfo[rec].haspaged = TRUE;
} }
reginfo[rec].lastcon = time(NULL); reginfo[rec].lastcon = (int)time(NULL);
return 0; return 0;
} }

View File

@ -19,8 +19,8 @@ typedef struct _reg_info {
char prg[15]; /* Program name */ char prg[15]; /* Program name */
char city[36]; /* Users city */ char city[36]; /* Users city */
char doing[36]; /* What is going on */ char doing[36]; /* What is going on */
time_t started; /* Startime connection */ int started; /* Startime connection */
time_t lastcon; /* Last connection */ int lastcon; /* Last connection */
int altime; /* Alarm time */ int altime; /* Alarm time */
unsigned silent : 1; /* Do not disturb */ unsigned silent : 1; /* Do not disturb */
unsigned ismsg : 1; /* Message waiting */ unsigned ismsg : 1; /* Message waiting */