Skip to content

Commit

Permalink
ua_db.cc: fix class-memaccess warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
pstorz authored and franku committed Nov 5, 2019
1 parent 729ffe4 commit 5af3fd6
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions core/src/dird/ua_db.cc
Expand Up @@ -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-2015 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
Expand Down Expand Up @@ -36,6 +36,7 @@

namespace directordaemon {

static const PoolDbRecord emptyPoolDbRecord = {};
/* Imported subroutines */

/**
Expand Down Expand Up @@ -207,8 +208,6 @@ int CreatePool(JobControlRecord* jcr,
{
PoolDbRecord pr;

memset(&pr, 0, sizeof(pr));

bstrncpy(pr.Name, pool->resource_name_, sizeof(pr.Name));

if (db->GetPoolRecord(jcr, &pr)) {
Expand Down Expand Up @@ -265,7 +264,7 @@ bool SetPooldbrReferences(JobControlRecord* jcr,
bool ret = true;

if (pool->RecyclePool) {
memset(&rpool, 0, sizeof(rpool));
rpool = emptyPoolDbRecord;

bstrncpy(rpool.Name, pool->RecyclePool->resource_name_, sizeof(rpool.Name));
if (db->GetPoolRecord(jcr, &rpool)) {
Expand All @@ -283,7 +282,7 @@ bool SetPooldbrReferences(JobControlRecord* jcr,
}

if (pool->ScratchPool) {
memset(&rpool, 0, sizeof(rpool));
rpool = emptyPoolDbRecord;

bstrncpy(rpool.Name, pool->ScratchPool->resource_name_, sizeof(rpool.Name));
if (db->GetPoolRecord(jcr, &rpool)) {
Expand Down Expand Up @@ -359,8 +358,7 @@ int UpdatePoolReferences(JobControlRecord* jcr,
PoolDbRecord pr;

if (!pool->RecyclePool && !pool->ScratchPool) { return true; }

memset(&pr, 0, sizeof(pr));
pr = emptyPoolDbRecord;
bstrncpy(pr.Name, pool->resource_name_, sizeof(pr.Name));

if (!db->GetPoolRecord(jcr, &pr)) { return -1; /* not exists in database */ }
Expand Down

0 comments on commit 5af3fd6

Please sign in to comment.