Skip to content

Commit

Permalink
apply bareos-check-sources
Browse files Browse the repository at this point in the history
  • Loading branch information
alaaeddineelamri committed Mar 23, 2023
1 parent dd2906f commit bcbada3
Show file tree
Hide file tree
Showing 15 changed files with 76 additions and 134 deletions.
2 changes: 1 addition & 1 deletion core/scripts/bareos-config-lib.sh.in
@@ -1,6 +1,6 @@
# BAREOS® - Backup Archiving REcovery Open Sourced
#
# Copyright (C) 2013-2022 Bareos GmbH & Co. KG
# Copyright (C) 2013-2023 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
2 changes: 1 addition & 1 deletion core/src/benchmarks/CMakeLists.txt
@@ -1,6 +1,6 @@
# BAREOS® - Backup Archiving REcovery Open Sourced
#
# Copyright (C) 2021-2021 Bareos GmbH & Co. KG
# Copyright (C) 2021-2023 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
32 changes: 11 additions & 21 deletions core/src/cats/postgresql.cc
Expand Up @@ -3,7 +3,7 @@
Copyright (C) 2003-2011 Free Software Foundation Europe e.V.
Copyright (C) 2011-2016 Planets Communications B.V.
Copyright (C) 2013-2022 Bareos GmbH & Co. KG
Copyright (C) 2013-2023 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 @@ -155,10 +155,8 @@ bool BareosDbPostgresql::CheckDatabaseEncoding(JobControlRecord* jcr)
retval = bstrcmp(row[0], "SQL_ASCII");

if (retval) {
/*
* If we are in SQL_ASCII, we can force the client_encoding to SQL_ASCII
* too
*/
/* If we are in SQL_ASCII, we can force the client_encoding to SQL_ASCII
* too */
SqlQueryWithoutHandler("SET client_encoding TO 'SQL_ASCII'");
} else {
// Something is wrong with database encoding
Expand Down Expand Up @@ -241,11 +239,9 @@ bool BareosDbPostgresql::OpenDatabase(JobControlRecord* jcr)
SqlQueryWithoutHandler("SET datestyle TO 'ISO, YMD'");
SqlQueryWithoutHandler("SET cursor_tuple_fraction=1");

/*
* Tell PostgreSQL we are using standard conforming strings
/* Tell PostgreSQL we are using standard conforming strings
* and avoid warnings such as:
* WARNING: nonstandard use of \\ in a string literal
*/
* WARNING: nonstandard use of \\ in a string literal */
SqlQueryWithoutHandler("SET standard_conforming_strings=on");

// Check that encoding is SQL_ASCII
Expand Down Expand Up @@ -434,10 +430,8 @@ void BareosDbPostgresql::StartTransaction(JobControlRecord* jcr)
jcr->ar = (AttributesDbRecord*)malloc(sizeof(AttributesDbRecord));
}

/*
* This is turned off because transactions break
* if multiple simultaneous jobs are run.
*/
/* This is turned off because transactions break
* if multiple simultaneous jobs are run. */
if (!allow_transactions_) { return; }

DbLocker _{this};
Expand Down Expand Up @@ -626,11 +620,9 @@ bool BareosDbPostgresql::SqlQueryWithoutHandler(const char* query, int)
}

if (try_reconnect_ && !transaction_) {
/*
* Only try reconnecting when no transaction is pending.
/* Only try reconnecting when no transaction is pending.
* Reconnecting within a transaction will lead to an aborted
* transaction anyway so we better follow our old error path.
*/
* transaction anyway so we better follow our old error path. */
if (retry) {
PQreset(db_handle_);

Expand Down Expand Up @@ -766,8 +758,7 @@ uint64_t BareosDbPostgresql::SqlInsertAutokeyRecord(const char* query,

changes++;

/*
* Obtain the current value of the sequence that
/* Obtain the current value of the sequence that
* provides the serial value for primary key of the table.
*
* currval is local to our session. It is not affected by
Expand All @@ -781,8 +772,7 @@ uint64_t BareosDbPostgresql::SqlInsertAutokeyRecord(const char* query,
* Except for basefiles which has a primary key on baseid.
* Therefore, we need to special case that one table.
*
* everything else can use the PostgreSQL formula.
*/
* everything else can use the PostgreSQL formula. */
if (Bstrcasecmp(table_name, "basefiles")) {
bstrncpy(sequence, "basefiles_baseid", sizeof(sequence));
} else {
Expand Down
8 changes: 4 additions & 4 deletions core/src/cats/postgresql.h
Expand Up @@ -3,7 +3,7 @@
Copyright (C) 2009-2011 Free Software Foundation Europe e.V.
Copyright (C) 2016-2016 Planets Communications B.V.
Copyright (C) 2016-2022 Bareos GmbH & Co. KG
Copyright (C) 2016-2023 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 All @@ -20,8 +20,8 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
*/
#ifndef BAREOS_CATS_BDB_POSTGRESQL_H_
#define BAREOS_CATS_BDB_POSTGRESQL_H_
#ifndef BAREOS_CATS_POSTGRESQL_H_
#define BAREOS_CATS_POSTGRESQL_H_

#include "include/bareos.h"

Expand Down Expand Up @@ -126,4 +126,4 @@ class BareosDbPostgresql : public BareosDb {
};

#endif /* HAVE_POSTGRESQL */
#endif // BAREOS_CATS_BDB_POSTGRESQL_H_
#endif // BAREOS_CATS_POSTGRESQL_H_
2 changes: 1 addition & 1 deletion core/src/cats/postgresql_batch.cc
Expand Up @@ -3,7 +3,7 @@
Copyright (C) 2003-2011 Free Software Foundation Europe e.V.
Copyright (C) 2011-2016 Planets Communications B.V.
Copyright (C) 2013-2022 Bareos GmbH & Co. KG
Copyright (C) 2013-2023 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
20 changes: 7 additions & 13 deletions core/src/dird/check_catalog.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) 2019-2019 Bareos GmbH & Co. KG
Copyright (C) 2019-2023 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 @@ -48,10 +48,8 @@ bool CheckCatalog(cat_op mode)
foreach_res (catalog, R_CATALOG) {
BareosDb* db;

/*
* Make sure we can open catalog, otherwise print a warning
* message because the server is probably not running.
*/
/* Make sure we can open catalog, otherwise print a warning
* message because the server is probably not running. */
db = db_init_database(NULL, catalog->db_driver, catalog->db_name,
catalog->db_user, catalog->db_password.value,
catalog->db_address, catalog->db_port,
Expand Down Expand Up @@ -90,10 +88,8 @@ bool CheckCatalog(cat_op mode)
/* Loop over all pools, defining/updating them in each database */
PoolResource* pool;
foreach_res (pool, R_POOL) {
/*
* If the Pool has a catalog resource create the pool only
* in that catalog.
*/
/* If the Pool has a catalog resource create the pool only
* in that catalog. */
if (!pool->catalog || pool->catalog == catalog) {
CreatePool(NULL, db, pool, POOL_OP_UPDATE); /* update request */
}
Expand All @@ -103,10 +99,8 @@ bool CheckCatalog(cat_op mode)
* references (RecyclePool)
*/
foreach_res (pool, R_POOL) {
/*
* If the Pool has a catalog resource update the pool only
* in that catalog.
*/
/* If the Pool has a catalog resource update the pool only
* in that catalog. */
if (!pool->catalog || pool->catalog == catalog) {
UpdatePoolReferences(NULL, db, pool);
}
Expand Down
2 changes: 1 addition & 1 deletion core/src/dird/dbcheck_utils.h
@@ -1,7 +1,7 @@
/*
BAREOS® - Backup Archiving REcovery Open Sourced
Copyright (C) 2021-2021 Bareos GmbH & Co. KG
Copyright (C) 2021-2023 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
14 changes: 5 additions & 9 deletions core/src/dird/dird.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-2022 Bareos GmbH & Co. KG
Copyright (C) 2013-2023 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 @@ -434,10 +434,8 @@ extern "C" void SighandlerReloadConfig(int, siginfo_t*, void*)
static bool is_reloading = false;

if (is_reloading) {
/*
* Note: don't use Jmsg here, as it could produce a race condition
* on multiple parallel reloads
*/
/* Note: don't use Jmsg here, as it could produce a race condition
* on multiple parallel reloads */
Qmsg(nullptr, M_ERROR, 0, _("Already reloading. Request ignored.\n"));
return;
}
Expand All @@ -454,10 +452,8 @@ static bool InitSighandlerSighup()
sigset_t block_mask;
struct sigaction action = {};

/*
* while handling SIGHUP signal,
* ignore further SIGHUP signals.
*/
/* while handling SIGHUP signal,
* ignore further SIGHUP signals. */
sigemptyset(&block_mask);
sigaddset(&block_mask, SIGHUP);

Expand Down
2 changes: 1 addition & 1 deletion core/src/dird/dird_conf.h
Expand Up @@ -3,7 +3,7 @@
Copyright (C) 2000-2011 Free Software Foundation Europe e.V.
Copyright (C) 2011-2012 Planets Communications B.V.
Copyright (C) 2013-2022 Bareos GmbH & Co. KG
Copyright (C) 2013-2023 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

0 comments on commit bcbada3

Please sign in to comment.