silcd.c
- Author: Pekka Riikonen <priikone@poseidon.pspt.fi>
+ Author: Pekka Riikonen <priikone@silcnet.org>
Copyright (C) 1997 - 2001 Pekka Riikonen
int opt, option_index;
char *config_file = NULL;
SilcServer silcd;
+ struct sigaction sa;
+ char pid[10];
silc_debug = FALSE;
"version %s (base: SILC Toolkit %s)\n",
silc_dist_version, silc_version);
printf("(c) 1997 - 2001 Pekka Riikonen "
- "<priikone@poseidon.pspt.fi>\n");
+ "<priikone@silcnet.org>\n");
exit(0);
break;
case 'd':
if (ret == FALSE)
goto fail;
+ /* Ignore SIGPIPE */
+ sa.sa_handler = SIG_IGN;
+ sa.sa_flags = 0;
+ sigemptyset(&sa.sa_mask);
+ sigaction(SIGPIPE, &sa, NULL);
+
if (silc_debug == FALSE)
/* Before running the server, fork to background and set
both user and group no non-root */
silc_server_daemonise(silcd);
+
+ /* Set /var/run/silcd.pid */
+ unlink(SILC_SERVER_PID_FILE);
+ memset(pid, 0, sizeof(pid));
+ snprintf(pid, sizeof(pid) - 1, "%d\n", getpid());
+ silc_file_writefile(SILC_SERVER_PID_FILE, pid, strlen(pid));
/* Run the server. When this returns the server has been stopped
and we will exit. */