memcached/memcached-1.2.3-save_pid_fix.patch

19 lines
828 B
Diff

--- memcached-1.2.3/memcached.c.save_pid_fix 2007-08-06 07:12:55.000000000 -0700
+++ memcached-1.2.3/memcached.c 2007-08-06 07:13:44.000000000 -0700
@@ -2723,11 +2723,12 @@ int main (int argc, char **argv) {
fprintf(stderr, "failed to create listening connection");
exit(EXIT_FAILURE);
}
- /* save the PID in if we're a daemon */
- if (daemonize)
- save_pid(getpid(), pid_file);
/* start up worker threads if MT mode */
thread_init(settings.num_threads, main_base);
+ /* save the PID in if we're a daemon, do this after thread_init due to
+ a file descriptor handling bug somewhere in libevent */
+ if (daemonize)
+ save_pid(getpid(), pid_file);
/* initialise clock event */
clock_handler(0, 0, 0);
/* initialise deletion array and timer event */