Skip to content

Commit

Permalink
dir_cmd: lock and unlock resource when getting client
Browse files Browse the repository at this point in the history
  • Loading branch information
alaaeddineelamri authored and arogge committed Mar 2, 2023
1 parent 390ad97 commit 718c433
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions core/src/filed/dir_cmd.cc
Expand Up @@ -1802,9 +1802,12 @@ static bool BackupCmd(JobControlRecord* jcr)
BareosSocket* dir = jcr->dir_bsock;
BareosSocket* sd = jcr->store_bsock;
crypto_cipher_t cipher = CRYPTO_CIPHER_NONE;
ClientResource* client
= (ClientResource*)my_config->GetNextRes(R_CLIENT, NULL);

ClientResource* client = nullptr;
{
ResLocker _{my_config};
client = (ClientResource*)my_config->GetNextRes(R_CLIENT, NULL);
}
/* See if we are in restore only mode then we don't allow a backup to be
* initiated. */
if (restore_only_mode) {
Expand Down

0 comments on commit 718c433

Please sign in to comment.