+ int pid_fd = -1;
+
+ /* open pidfile .. defer write until in child and after setuid */
+ if (pidfile)
+ {
+ pid_fd = open(pidfile, O_CREAT|O_RDWR, 0666);
+ if (pid_fd == -1)
+ {
+ yaz_log(YLOG_FATAL|YLOG_ERRNO, "open %s", pidfile);
+ exit(1);
+ }
+ }