- prevent wrong pidfile unlinking on graceful restart (patch by Chris Webb)

git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@1656 152afb58-edef-0310-8abb-c4023f1b3aa9
svn/tags/lighttpd-1.4.14
Elan Ruusamäe 2007-02-17 18:17:00 +00:00
parent 1c662e07ba
commit 72ac4ece2e
1 changed files with 15 additions and 1 deletions

View File

@ -1232,6 +1232,19 @@ int main (int argc, char **argv) {
srv_socket->fd = -1;
/* network_close() will cleanup after us */
if (srv->srvconf.pid_file->used &&
srv->srvconf.changeroot->used == 0) {
if (0 != unlink(srv->srvconf.pid_file->ptr)) {
if (errno != EACCES && errno != EPERM) {
log_error_write(srv, __FILE__, __LINE__, "sbds",
"unlink failed for:",
srv->srvconf.pid_file,
errno,
strerror(errno));
}
}
}
}
}
@ -1336,7 +1349,8 @@ int main (int argc, char **argv) {
}
if (srv->srvconf.pid_file->used &&
srv->srvconf.changeroot->used == 0) {
srv->srvconf.changeroot->used == 0 &&
0 == graceful_shutdown) {
if (0 != unlink(srv->srvconf.pid_file->ptr)) {
if (errno != EACCES && errno != EPERM) {
log_error_write(srv, __FILE__, __LINE__, "sbds",