--- sshd.c.orig +++ sshd.c @@ -1812,7 +1812,7 @@ main(int ac, char **av) * Write out the pid file after the sigterm handler * is setup and the listen sockets are bound */ - if (!debug_flag) { + if (!debug_flag || !no_daemon_flag) { FILE *f = fopen(options.pid_file, "w"); if (f == NULL) {