From b8ad8275c27afd58015dbc70ff9ce65637e96839 Mon Sep 17 00:00:00 2001 From: Andre Noll Date: Fri, 11 Nov 2011 21:50:56 +0100 Subject: [PATCH] Revert "server: Listen on command socket before daemonizing." This reverts commit 7a4b6d5f19976ceac581f6dc235fcbd9b30c767f, which was a rather bad idea because it caused the afs process to inherit the open file descriptor of the command socket, so two processes listened on the command socket at the same time. Even worse, the afs process also inherited the command task in its scheduler setup, causing it to answer incoming connections as well. In fact it was more or less random which of the two processes served an incoming connection. If it was the afs process, interesting things happened in the command handler due to its address space being a copy of the afs process, where parts of what is needed for some commands not properly set up. For example the si and the sender commands segfaulted due to a NULL pointer dereference. It's weird that this bug was not noticed earlier. --- server.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server.c b/server.c index 0cfac607..82f48e00 100644 --- a/server.c +++ b/server.c @@ -491,7 +491,6 @@ static void server_init(int argc, char **argv) gettimeofday(now, NULL); set_server_start_time(now); init_user_list(user_list_file); - init_server_command_task(argc, argv); /* become daemon */ if (conf.daemon_given) daemonize(); @@ -519,6 +518,7 @@ static void server_init(int argc, char **argv) para_unblock_signal(SIGCHLD); PARA_NOTICE_LOG("initializing virtual streaming system\n"); init_vss_task(afs_socket); + init_server_command_task(argc, argv); PARA_NOTICE_LOG("server init complete\n"); } -- 2.39.5