diff --git a/core/src/dird/dird.cc b/core/src/dird/dird.cc index 7e3afb0bb47..15016eac167 100644 --- a/core/src/dird/dird.cc +++ b/core/src/dird/dird.cc @@ -3,7 +3,7 @@ Copyright (C) 2000-2012 Free Software Foundation Europe e.V. Copyright (C) 2011-2016 Planets Communications B.V. - Copyright (C) 2013-2018 Bareos GmbH & Co. KG + Copyright (C) 2013-2019 Bareos GmbH & Co. KG This program is Free Software; you can redistribute it and/or modify it under the terms of version three of the GNU Affero General Public @@ -67,6 +67,9 @@ using namespace directordaemon; /* Forward referenced subroutines */ namespace directordaemon { + +static const ClientDbRecord emptyClientDbRecord = {}; + #if !defined(HAVE_WIN32) static #endif @@ -552,7 +555,6 @@ static bool InitSighandlerSighup() sigemptyset(&block_mask); sigaddset(&block_mask, SIGHUP); - memset(&action, 0, sizeof(action)); action.sa_sigaction = SighandlerReloadConfig; action.sa_mask = block_mask; action.sa_flags = SA_SIGINFO; @@ -993,7 +995,7 @@ static bool CheckCatalog(cat_op mode) } Dmsg2(500, "create cat=%s for client=%s\n", client->catalog->resource_name_, client->resource_name_); - memset(&cr, 0, sizeof(cr)); + cr = emptyClientDbRecord; bstrncpy(cr.Name, client->resource_name_, sizeof(cr.Name)); db->CreateClientRecord(NULL, &cr); } @@ -1003,8 +1005,6 @@ static bool CheckCatalog(cat_op mode) foreach_res (store, R_STORAGE) { StorageDbRecord sr; MediaTypeDbRecord mtr; - memset(&sr, 0, sizeof(sr)); - memset(&mtr, 0, sizeof(mtr)); if (store->media_type) { bstrncpy(mtr.MediaType, store->media_type, sizeof(mtr.MediaType)); mtr.ReadOnly = 0;