| 34 |
|
#include "fdlist.h" |
| 35 |
|
#include "hash.h" |
| 36 |
|
#include "irc_string.h" |
| 37 |
– |
#include "sprintf_irc.h" |
| 37 |
|
#include "ircd_signal.h" |
| 38 |
|
#include "s_gline.h" |
| 39 |
|
#include "motd.h" |
| 76 |
|
struct server_info ServerInfo; |
| 77 |
|
/* admin info set from ircd.conf */ |
| 78 |
|
struct admin_info AdminInfo = { NULL, NULL, NULL }; |
| 79 |
< |
struct Counter Count = { 0, 0, 0, 0, 0, 0, 0, 0 }; |
| 79 |
> |
struct Counter Count = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; |
| 80 |
|
struct ServerState_t server_state = { 0 }; |
| 81 |
|
struct logging_entry ConfigLoggingEntry = { 1, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0} }; |
| 82 |
|
struct ServerStatistics ServerStats; |
| 194 |
|
|
| 195 |
|
if (newtime.tv_sec < CurrentTime) |
| 196 |
|
{ |
| 197 |
< |
ircsprintf(to_send, "System clock is running backwards - (%lu < %lu)", |
| 198 |
< |
(unsigned long)newtime.tv_sec, (unsigned long)CurrentTime); |
| 197 |
> |
snprintf(to_send, sizeof(to_send), |
| 198 |
> |
"System clock is running backwards - (%lu < %lu)", |
| 199 |
> |
(unsigned long)newtime.tv_sec, (unsigned long)CurrentTime); |
| 200 |
|
report_error(L_ALL, to_send, me.name, 0); |
| 201 |
|
set_back_events(CurrentTime - newtime.tv_sec); |
| 202 |
|
} |
| 354 |
|
{ |
| 355 |
|
char buff[32]; |
| 356 |
|
unsigned int pid = (unsigned int)getpid(); |
| 357 |
< |
size_t nbytes = ircsprintf(buff, "%u\n", pid); |
| 357 |
> |
size_t nbytes = snprintf(buff, sizeof(buff), "%u\n", pid); |
| 358 |
|
|
| 359 |
|
if ((fbputs(buff, fb, nbytes) == -1)) |
| 360 |
|
ilog(L_ERROR, "Error writing %u to pid file %s (%s)", |
| 501 |
|
/* It ain't random, but it ought to be a little harder to guess */ |
| 502 |
|
init_genrand(SystemTime.tv_sec ^ (SystemTime.tv_usec | (getpid() << 20))); |
| 503 |
|
|
| 504 |
– |
memset(&me, 0, sizeof(me)); |
| 505 |
– |
memset(&meLocalUser, 0, sizeof(meLocalUser)); |
| 504 |
|
me.localClient = &meLocalUser; |
| 505 |
|
dlinkAdd(&me, &me.node, &global_client_list); /* Pointer to beginning |
| 506 |
|
of Client list */ |
| 509 |
– |
|
| 510 |
– |
memset(&ServerInfo, 0, sizeof(ServerInfo)); |
| 511 |
– |
memset(&ServerStats, 0, sizeof(ServerStats)); |
| 512 |
– |
|
| 507 |
|
/* Initialise the channel capability usage counts... */ |
| 508 |
|
init_chcap_usage_counts(); |
| 509 |
|
|
| 604 |
|
|
| 605 |
|
strlcpy(me.info, ServerInfo.description, sizeof(me.info)); |
| 606 |
|
|
| 607 |
< |
me.from = &me; |
| 608 |
< |
me.servptr = &me; |
| 607 |
> |
me.from = &me; |
| 608 |
> |
me.servptr = &me; |
| 609 |
> |
me.lasttime = me.since = me.firsttime = CurrentTime; |
| 610 |
|
|
| 611 |
|
SetMe(&me); |
| 612 |
|
make_server(&me); |
| 613 |
|
|
| 619 |
– |
me.lasttime = me.since = me.firsttime = CurrentTime; |
| 620 |
– |
|
| 614 |
|
hash_add_id(&me); |
| 615 |
|
hash_add_client(&me); |
| 616 |
|
|
| 617 |
|
/* add ourselves to global_serv_list */ |
| 618 |
|
dlinkAdd(&me, make_dlink_node(), &global_serv_list); |
| 619 |
|
|
| 627 |
– |
#ifndef STATIC_MODULES |
| 620 |
|
if (chdir(MODPATH)) |
| 621 |
|
{ |
| 622 |
|
ilog(L_CRIT, "Could not load core modules. Terminating!"); |
| 633 |
|
perror("chdir"); |
| 634 |
|
exit(EXIT_FAILURE); |
| 635 |
|
} |
| 636 |
< |
#else |
| 645 |
< |
load_all_modules(1); |
| 646 |
< |
#endif |
| 636 |
> |
|
| 637 |
|
/* |
| 638 |
|
* assemble_umode_buffer() has to be called after |
| 639 |
|
* reading conf/loading modules. |