From: Eric Bollengier Date: Fri, 4 Jul 2014 14:26:06 +0000 (+0200) Subject: Fix segfault when trying to stop the bnet_server thread in terminate_stored() X-Git-Tag: Release-7.0.5~31 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=ce5634e327b6faa90fcc947179ff55963823ba79;p=bacula%2Fbacula Fix segfault when trying to stop the bnet_server thread in terminate_stored() Conflicts: bacula/src/stored/stored.c --- diff --git a/bacula/src/stored/stored.c b/bacula/src/stored/stored.c index e82f53ffd0..ab548daa62 100644 --- a/bacula/src/stored/stored.c +++ b/bacula/src/stored/stored.c @@ -61,6 +61,7 @@ uint32_t VolSessionTime; char *configfile = NULL; bool init_done = false; static pthread_t server_tid; +static bool server_tid_valid = false; /* Global static variables */ static bool foreground = 0; @@ -271,6 +272,7 @@ int main (int argc, char *argv[]) /* Single server used for Director and File daemon */ server_tid = pthread_self(); + server_tid_valid = true; bnet_thread_server(me->sdaddrs, me->max_concurrent_jobs * 2 + 1, &dird_workq, handle_connection_request); exit(1); /* to keep compiler quiet */ @@ -674,8 +676,9 @@ void terminate_stored(int sig) Dmsg1(10, "No dev structure %s\n", device->device_name); } } - - bnet_stop_thread_server(server_tid); + if (server_tid_valid) { + bnet_stop_thread_server(server_tid); + } if (configfile) { free(configfile); configfile = NULL;