+ if(pidfile) {
+ if(!strcmp(pidfile, "-")) {
+ if(!outname) {
+ flog(LOG_ERR, "accesslog: cannot derive PID file name without an output file");
+ exit(1);
+ }
+ pidfile = sprintf2("%s.pid", outname);
+ }
+ if((pidout = fopen(pidfile, "w")) == NULL) {
+ flog(LOG_ERR, "accesslog: could not open PID file %s for writing: %s", pidfile);
+ exit(1);
+ }
+ fprintf(pidout, "%i\n", (int)getpid());
+ fclose(pidout);
+ }