Fixes for mbtask

This commit is contained in:
Michiel Broek 2003-01-27 21:55:42 +00:00
parent d200e2c1b4
commit 8c5034f00f
4 changed files with 164 additions and 144 deletions

View File

@ -29,6 +29,9 @@ v0.37.01 14-Jan-2003.
Fixed a bug where one of the nodelists was node closed with
each outbound scan and was causing mbtask to stop functioning
after a few days.
After forking the daemon, the stdin, stdout and stderr are
reopend to /dev/null.
Zero the daily status counters finally works again.
mbfile:
In the import function several bugfixes for reading files.bbs.

4
TODO
View File

@ -93,6 +93,10 @@ mbfido:
N: Let mbfido areas with a special switch update area descriptions.
N: Send rulefile via netmail for each new connected mail area.
N: Send notifications to downlinks about changed areas from uplink.
mbcico:
N: Implement MD5 crypt in binkp protocol driver.

View File

@ -1290,13 +1290,13 @@ int main(int argc, char **argv)
pw = getpwnam((char *)"mbse");
if (setuid(pw->pw_uid)) {
perror("");
printf("can't setuid to mbse\n");
fprintf(stderr, "can't setuid to mbse\n");
close(ping_isocket);
exit(MBERR_INIT_ERROR);
}
if (setgid(pw->pw_gid)) {
perror("");
printf("can't setgid to bbs\n");
fprintf(stderr, "can't setgid to bbs\n");
close(ping_isocket);
exit(MBERR_INIT_ERROR);
}
@ -1356,8 +1356,20 @@ int main(int argc, char **argv)
* Starting the deamon child process here.
*/
fclose(stdin);
if (open("/dev/null", O_RDONLY) != 0) {
Syslog('?', "$Reopen of stdin to /dev/null failed");
_exit(MBERR_EXEC_FAILED);
}
fclose(stdout);
if (open("/dev/null", O_WRONLY | O_APPEND | O_CREAT,0600) != 1) {
Syslog('?', "$Reopen of stdout to /dev/null failed");
_exit(MBERR_EXEC_FAILED);
}
fclose(stderr);
if (open("/dev/null", O_WRONLY | O_APPEND | O_CREAT,0600) != 2) {
Syslog('?', "$Reopen of stderr to /dev/null failed");
_exit(MBERR_EXEC_FAILED);
}
scheduler();
/* Not reached */
default:

View File

@ -143,19 +143,20 @@ void status_init()
void status_write(void);
void status_write(void)
{
int d, stat_fd;
struct tm *ttm, *ytm;
int d, stat_fd, yday;
struct tm *ttm;
time_t temp;
temp = time(NULL);
ttm = localtime(&temp);
yday = ttm->tm_yday;
temp = status.daily; // On a Sparc, first put the time in temp, then pass it to locattime.
ytm = localtime(&temp);
ttm = localtime(&temp);
/*
* If we passed to the next day, zero the today counters
*/
if (ttm->tm_yday != ytm->tm_yday) {
if (yday != ttm->tm_yday) {
Syslog('+', "Last days statistics:");
Syslog('+', "Total clients : %lu", status.today.tot_clt);
Syslog('+', "Peak clients : %lu", status.today.peak_clt);