From: Michal Rakowski Date: Fri, 6 Aug 2021 16:35:46 +0000 (+0200) Subject: Fix compilation warning in storage manager to get rid of 'initialzer lists' warning X-Git-Tag: Release-11.3.2~397 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=94a323373c3650b3b8dc87fe75436e6aeacb4572;p=thirdparty%2Fbacula.git Fix compilation warning in storage manager to get rid of 'initialzer lists' warning Description: when using: mutex = PTHREAD_MUTEX_INITIALIZER; instead of: pthread_mutex_init(&mutex, NULL); There could be warning on some environments: store_mngr.c:31:10: warning: extended initializer lists only available with -std=c++11 or -std=gnu++11 [enabled by default] mutex = PTHREAD_MUTEX_INITIALIZER; To get rid of it, simply use the init/destroy mutex helpers. --- diff --git a/bacula/src/dird/store_mngr.c b/bacula/src/dird/store_mngr.c index 3e6b8afa8..45383fc72 100644 --- a/bacula/src/dird/store_mngr.c +++ b/bacula/src/dird/store_mngr.c @@ -30,7 +30,7 @@ storage::storage() { list_str = get_pool_memory(PM_MESSAGE); *source = 0; store = NULL; - mutex = PTHREAD_MUTEX_INITIALIZER; + pthread_mutex_init(&mutex, NULL); } storage::~storage() { @@ -49,6 +49,8 @@ storage::~storage() { if (list_str) { free_and_null_pool_memory(list_str); } + + pthread_mutex_destroy(&mutex); } void storage::set_rw(bool write) {