Changes with Apache 2.3.0
[Remove entries to the current 2.0 and 2.2 section below, when backported]
+ *) mod_cgid: Append .PID to the script socket filename and remove the
+ script socket on exit. [Colm MacCarthaigh]
+
*) prefork and worker MPM's: Prevent children from holding open listening
ports upon graceful restart. PR28167.
[Colm MacCarthaigh, Brian Pinkerton <bp thinkpink.com>]
* up when pconf gets cleaned up
*/
kill(proc->pid, SIGHUP); /* send signal to daemon telling it to die */
+
+ /* Remove the cgi socket, we must do it here in order to try and
+ * guarantee the same permissions as when the socket was created.
+ */
+ if (unlink(sockname) < 0 && errno != ENOENT) {
+ ap_log_error(APLOG_MARK, APLOG_ERR, errno, NULL,
+ "Couldn't unlink unix domain socket %s",
+ sockname);
+ }
break;
}
}
apr_signal(SIGCHLD, SIG_IGN);
apr_signal(SIGHUP, daemon_signal_handler);
- if (unlink(sockname) < 0 && errno != ENOENT) {
- ap_log_error(APLOG_MARK, APLOG_ERR, errno, main_server,
- "Couldn't unlink unix domain socket %s",
- sockname);
- /* just a warning; don't bail out */
- }
-
if ((sd = socket(AF_UNIX, SOCK_STREAM, 0)) < 0) {
ap_log_error(APLOG_MARK, APLOG_ERR, errno, main_server,
"Couldn't create unix domain socket");
static int cgid_pre_config(apr_pool_t *pconf, apr_pool_t *plog,
apr_pool_t *ptemp)
{
- sockname = DEFAULT_SOCKET;
+ sockname = apr_psprintf(pconf, "%s.%" APR_PID_T_FMT, DEFAULT_SOCKET,
+ getpid());
return OK;
}
if (err != NULL) {
return err;
}
-
- sockname = ap_server_root_relative(cmd->pool, arg);
+
+ /* Make sure the pid is appended to the sockname */
+ sockname = apr_psprintf(cmd->pool, "%s.%" APR_PID_T_FMT, arg, getpid());
+ sockname = ap_server_root_relative(cmd->pool, sockname);
if (!sockname) {
return apr_pstrcat(cmd->pool, "Invalid ScriptSock path",