jim 97/11/08 11:19:17
Modified: src CHANGES
src/main http_main.c
Log:
PR:1056
Reviewed by: Dean Gaudet, Martin Kraemer
Revision Changes Path
1.495 +5 -1 apachen/src/CHANGES
Index: CHANGES
===================================================================
RCS file: /export/home/cvs/apachen/src/CHANGES,v
retrieving revision 1.494
retrieving revision 1.495
diff -u -r1.494 -r1.495
--- CHANGES 1997/11/08 05:20:58 1.494
+++ CHANGES 1997/11/08 19:19:13 1.495
@@ -1,5 +1,9 @@
Changes with Apache 1.3b3
-
+
+ *) Fix problem with USE_FLOCK_SERIALIZED_ACCEPT not working
+ properly. Each child needs to open the lockfile instead
+ of using the passed file-descriptor from the parent. PR#1056
+
*) Fix the error logging in mod_cgi; the recent error log changes
introduced a bug that prevented it from working correctly.
[M.D.Parker] PR#1352
1.247 +30 -4 apachen/src/main/http_main.c
Index: http_main.c
===================================================================
RCS file: /export/home/cvs/apachen/src/main/http_main.c,v
retrieving revision 1.246
retrieving revision 1.247
diff -u -r1.246 -r1.247
--- http_main.c 1997/11/06 21:54:10 1.246
+++ http_main.c 1997/11/08 19:19:15 1.247
@@ -280,6 +280,8 @@
#define accept_mutex_cleanup()
+#define accept_mutex_child_init(x)
+
static void accept_mutex_init(pool *p)
{
ptrdiff_t old;
@@ -366,6 +368,8 @@
accept_mutex = (void *)(caddr_t)-1;
}
+#define accept_mutex_child_init(x)
+
static void accept_mutex_init(pool *p)
{
pthread_mutexattr_t mattr;
@@ -483,6 +487,7 @@
semctl(sem_id, 0, IPC_RMID, ick);
}
+#define accept_mutex_child_init(x)
static void accept_mutex_init(pool *p)
{
@@ -556,6 +561,8 @@
#define accept_mutex_cleanup()
+#define accept_mutex_child_init(x)
+
/*
* Initialize mutex lock.
* Must be safe to call this on a restart.
@@ -611,23 +618,40 @@
static int lock_fd = -1;
-#define accept_mutex_cleanup()
+static void accept_mutex_cleanup(void)
+{
+ unlink(lock_fname);
+}
/*
* Initialize mutex lock.
+ * Done by each child at it's birth
+ */
+static void accept_mutex_child_init(pool *p)
+{
+
+ lock_fd = popenf(p, lock_fname, O_WRONLY, 0600);
+ if (lock_fd == -1) {
+ aplog_error(APLOG_MARK, APLOG_EMERG, server_conf,
+ "Child cannot open lock file: %s\n", lock_fname);
+ exit(1);
+ }
+}
+/*
+ * Initialize mutex lock.
* Must be safe to call this on a restart.
*/
static void accept_mutex_init(pool *p)
{
expand_lock_fname(p);
- lock_fd = popenf(p, lock_fname, O_CREAT | O_WRONLY | O_EXCL, 0644);
+ unlink(lock_fname);
+ lock_fd = popenf(p, lock_fname, O_CREAT | O_WRONLY | O_EXCL, 0600);
if (lock_fd == -1) {
aplog_error(APLOG_MARK, APLOG_EMERG, server_conf,
- "Cannot open lock file: %s\n", lock_fname);
+ "Parent cannot open lock file: %s\n", lock_fname);
exit(1);
}
- unlink(lock_fname);
}
static void accept_mutex_on(void)
@@ -662,6 +686,7 @@
* the sockets. */
#define NO_SERIALIZED_ACCEPT
#define accept_mutex_cleanup()
+#define accept_mutex_child_init(x)
#define accept_mutex_init(x)
#define accept_mutex_on()
#define accept_mutex_off()
@@ -2672,6 +2697,7 @@
/* needs to be done before we switch UIDs so we have permissions */
reopen_scoreboard(pconf);
+ SAFE_ACCEPT(accept_mutex_child_init(pconf));
#ifdef MPE
/* Only try to switch if we're running as MANAGER.SYS */