From: Andre Noll Date: Wed, 3 Jan 2018 01:49:22 +0000 (+0100) Subject: afs: Allow database switching on sighup. X-Git-Tag: v0.6.2~4^2~2 X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=commitdiff_plain;h=42f69f545fad18480d728bb6f25273976a0c01e0 afs: Allow database switching on sighup. Currently the database dir is set at startup and stays unmodified even after the sighup handler has reloaded a configuration which specifies a different database path. This patch makes it possible to switch to a different database after SIGHUP was received. To make this work, we only have invalidate the database_dir pointer after the database has been closed. --- diff --git a/afs.c b/afs.c index bad8b8dc..00143799 100644 --- a/afs.c +++ b/afs.c @@ -638,16 +638,18 @@ static int setup_command_socket_or_die(void) return socket_fd; } +static char *database_dir; + static void close_afs_tables(void) { int i; PARA_NOTICE_LOG("closing afs_tables\n"); for (i = 0; i < NUM_AFS_TABLES; i++) afs_tables[i].close(); + free(database_dir); + database_dir = NULL; } -static char *database_dir; - static void get_database_dir(void) { if (!database_dir) { @@ -1022,6 +1024,7 @@ static int com_init_callback(struct afs_callback_arg *aca) int i, ret; close_afs_tables(); + get_database_dir(); for (i = 0; i < NUM_AFS_TABLES; i++) { struct afs_table *t = &afs_tables[i];