X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=blobdiff_plain;f=server.c;h=d5946e47386c03a40a802a1d407a69f7b0659fef;hp=a63aeefc357fe95e54386414390a5a951f2dc91f;hb=423ec3140c9774bbeaccb7afaef8e74b1d7d05f2;hpb=c252837b853b35f06fffe637b2a6bf16419da954 diff --git a/server.c b/server.c index a63aeefc..d5946e47 100644 --- a/server.c +++ b/server.c @@ -15,6 +15,9 @@ * */ +#include +#include +#include #include "para.h" #include "server.cmdline.h" @@ -348,9 +351,9 @@ out: exit(EXIT_FAILURE); } -static uint32_t afs_socket_cookie; +uint32_t afs_socket_cookie; static int afs_socket; -pid_t afs_pid; +static pid_t afs_pid; static void init_afs(void) { @@ -363,10 +366,16 @@ static void init_afs(void) afs_pid = fork(); if (afs_pid < 0) exit(EXIT_FAILURE); - if (!afs_pid) /* child (afs) */ + if (!afs_pid) { /* child (afs) */ + close(afs_server_socket[0]); afs_init(afs_socket_cookie, afs_server_socket[1]); + } close(afs_server_socket[1]); afs_socket = afs_server_socket[0]; + ret = mark_fd_nonblock(afs_socket); + if (ret < 0) + exit(EXIT_FAILURE); + add_close_on_fork_list(afs_socket); PARA_INFO_LOG("afs_socket: %d, afs_socket_cookie: %u\n", afs_socket, (unsigned) afs_socket_cookie); } @@ -435,6 +444,8 @@ static void handle_sighup(void) mmd->selector_change = mmd->selector_num; /* do not change selector.. */ change_selector(); /* .. just reload */ init_user_list(user_list_file); /* reload user list */ + if (afs_pid) + kill(afs_pid, SIGHUP); } static void status_refresh(void)