+ openlog(sprintf2("mctap-%s", tapname), LOG_PID, LOG_DAEMON);
+
+ pidfd = NULL;
+ if((pidfile != NULL) && ((pidfd = fopen(pidfile, "w")) == NULL)) {
+ fprintf(stderr, "mctap: could not create PID file %s: %s\n", pidfile, strerror(errno));
+ exit(1);
+ }
+ if(daemonize)
+ daemon(0, 0);
+ if(pidfd != NULL) {
+ fprintf(pidfd, "%i\n", getpid());
+ fclose(pidfd);
+ }
+
+ signal(SIGTERM, sighand);
+ signal(SIGINT, sighand);
+ signal(SIGHUP, sighand);