| 142 |
|
|
| 143 |
|
static int printVersion = 0; |
| 144 |
|
|
| 145 |
< |
struct lgetopt myopts[] = { |
| 145 |
> |
static struct lgetopt myopts[] = { |
| 146 |
|
{"dlinefile", &ConfigFileEntry.dlinefile, |
| 147 |
|
STRING, "File to use for dline.conf"}, |
| 148 |
|
{"configfile", &ConfigFileEntry.configfile, |
| 336 |
|
static void |
| 337 |
|
write_pidfile(const char *filename) |
| 338 |
|
{ |
| 339 |
< |
FBFILE *fb; |
| 339 |
> |
FILE *fb; |
| 340 |
|
|
| 341 |
< |
if ((fb = fbopen(filename, "w"))) |
| 341 |
> |
if ((fb = fopen(filename, "w"))) |
| 342 |
|
{ |
| 343 |
|
char buff[32]; |
| 344 |
|
unsigned int pid = (unsigned int)getpid(); |
| 345 |
– |
size_t nbytes = snprintf(buff, sizeof(buff), "%u\n", pid); |
| 345 |
|
|
| 346 |
< |
if ((fbputs(buff, fb, nbytes) == -1)) |
| 346 |
> |
snprintf(buff, sizeof(buff), "%u\n", pid); |
| 347 |
> |
|
| 348 |
> |
if ((fputs(buff, fb) == -1)) |
| 349 |
|
ilog(LOG_TYPE_IRCD, "Error writing %u to pid file %s (%s)", |
| 350 |
|
pid, filename, strerror(errno)); |
| 351 |
|
|
| 352 |
< |
fbclose(fb); |
| 352 |
< |
return; |
| 352 |
> |
fclose(fb); |
| 353 |
|
} |
| 354 |
|
else |
| 355 |
|
{ |
| 368 |
|
static void |
| 369 |
|
check_pidfile(const char *filename) |
| 370 |
|
{ |
| 371 |
< |
FBFILE *fb; |
| 371 |
> |
FILE *fb; |
| 372 |
|
char buff[32]; |
| 373 |
|
pid_t pidfromfile; |
| 374 |
|
|
| 375 |
|
/* Don't do logging here, since we don't have log() initialised */ |
| 376 |
< |
if ((fb = fbopen(filename, "r"))) |
| 376 |
> |
if ((fb = fopen(filename, "r"))) |
| 377 |
|
{ |
| 378 |
< |
if (fbgets(buff, 20, fb) == NULL) |
| 378 |
> |
if (fgets(buff, 20, fb) == NULL) |
| 379 |
|
{ |
| 380 |
|
/* log(L_ERROR, "Error reading from pid file %s (%s)", filename, |
| 381 |
|
* strerror(errno)); |
| 393 |
|
} |
| 394 |
|
} |
| 395 |
|
|
| 396 |
< |
fbclose(fb); |
| 396 |
> |
fclose(fb); |
| 397 |
|
} |
| 398 |
|
else if (errno != ENOENT) |
| 399 |
|
{ |
| 563 |
|
init_hash(); |
| 564 |
|
init_ip_hash_table(); /* client host ip hash table */ |
| 565 |
|
init_host_hash(); /* Host-hashtable. */ |
| 566 |
– |
clear_tree_parse(); |
| 566 |
|
init_client(); |
| 567 |
|
init_class(); |
| 568 |
< |
init_whowas(); |
| 568 |
> |
whowas_init(); |
| 569 |
|
watch_init(); |
| 570 |
|
init_auth(); /* Initialise the auth code */ |
| 571 |
|
init_resolver(); /* Needs to be setup before the io loop */ |