--- mathopd-1.5p5/src/main.c.orig 2005-03-22 21:46:55 +0300 +++ mathopd-1.5p5/src/main.c 2005-09-07 16:19:56 +0400 @@ -235,6 +235,13 @@ int main(int argc, char *argv[]) if (chdir("/") == -1) die("chdir", 0); } + if (pid_filename) { + pid_fd = open(pid_filename, O_WRONLY | O_CREAT, 0600); + if (pid_fd == -1) + die("open", "Cannot open PID file"); + } else { + pid_fd = -1; + } setuid(geteuid()); if (geteuid() == 0) { if (server_uid == 0) @@ -265,12 +272,6 @@ int main(int argc, char *argv[]) } setrlimit(RLIMIT_CORE, &rl); umask(fcm); - if (pid_filename) { - pid_fd = open(pid_filename, O_WRONLY | O_CREAT, 0666); - if (pid_fd == -1) - die("open", "Cannot open PID file"); - } else - pid_fd = -1; current_time = time(0); if (init_logs(tee) == -1) die("open", "Cannot open log files");