Skip to content

Commit

Permalink
M #-: Fix compilation warnings
Browse files Browse the repository at this point in the history
(cherry picked from commit c4c98e2)
  • Loading branch information
rsmontero committed Sep 5, 2020
1 parent 5dab5aa commit 22ff32e
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 16 deletions.
11 changes: 6 additions & 5 deletions include/AclManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ class AclManager : public Callbackable
bool authorize(int uid,
const std::set<int>& user_groups,
const PoolObjectAuth& obj_perms,
AuthRequest::Operation op);
AuthRequest::Operation op) const;

/**
* Takes an authorization request for oneadmin
Expand All @@ -90,7 +90,7 @@ class AclManager : public Callbackable
* @return true if the authorization is granted for oneadmin
*/
bool oneadmin_authorize(const PoolObjectAuth& obj_perms,
AuthRequest::Operation op);
AuthRequest::Operation op) const;

/**
* Adds a new rule to the ACL rule set
Expand Down Expand Up @@ -271,7 +271,8 @@ class AclManager : public Callbackable
long long resource_oid_mask,
long long resource_gid_mask,
long long resource_cid_mask,
const std::multimap<long long, AclRule*>& rules);
const std::multimap<long long, AclRule*>& rules) const;

/**
* Wrapper for match_rules. It will check if any rules in the temporary
* multimap or in the internal one grants permission.
Expand Down Expand Up @@ -299,7 +300,7 @@ class AclManager : public Callbackable
long long individual_obj_type,
long long group_obj_type,
long long cluster_obj_type,
const std::multimap<long long, AclRule*> &tmp_rules);
const std::multimap<long long, AclRule*> &tmp_rules) const;
/**
* Deletes all rules that match the user mask
*
Expand Down Expand Up @@ -334,7 +335,7 @@ class AclManager : public Callbackable
// Mutex synchronization
// -------------------------------------------------------------------------

std::mutex acl_mutex;
mutable std::mutex acl_mutex;

// -------------------------------------------------------------------------
// DataBase implementation variables
Expand Down
2 changes: 1 addition & 1 deletion include/Driver.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ class Driver
*/
void write(const std::string& str) const
{
::write(to_drv, str.c_str(), str.size());
(void) ::write(to_drv, str.c_str(), str.size());
};

/**
Expand Down
10 changes: 10 additions & 0 deletions include/VirtualMachineTemplate.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,16 @@ class VirtualMachineTemplate : public Template

VirtualMachineTemplate(VirtualMachineTemplate& vmt):Template(vmt){};

VirtualMachineTemplate& operator=(const VirtualMachineTemplate& t)
{
if (this != &t)
{
Template::operator=(t);
}

return *this;
}

void set_xml_root(const char * _xml_root)
{
Template::set_xml_root(_xml_root);
Expand Down
8 changes: 4 additions & 4 deletions src/acl/AclManager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ bool AclManager::authorize(
int uid,
const set<int>& user_groups,
const PoolObjectAuth& obj_perms,
AuthRequest::Operation op)
AuthRequest::Operation op) const
{
bool auth = false;

Expand Down Expand Up @@ -388,7 +388,7 @@ bool AclManager::authorize(

bool AclManager::oneadmin_authorize(
const PoolObjectAuth& obj_perms,
AuthRequest::Operation op)
AuthRequest::Operation op) const
{
if (static_cast<long long int>(op) & 0x10LL) //No lockable object
{
Expand All @@ -415,7 +415,7 @@ bool AclManager::match_rules_wrapper(
long long individual_obj_type,
long long group_obj_type,
long long cluster_obj_type,
const multimap<long long, AclRule*> &tmp_rules)
const multimap<long long, AclRule*> &tmp_rules) const
{
bool auth = false;

Expand Down Expand Up @@ -489,7 +489,7 @@ bool AclManager::match_rules(
long long resource_oid_mask,
long long resource_gid_mask,
long long resource_cid_mask,
const multimap<long long, AclRule*> &rules)
const multimap<long long, AclRule*> &rules) const

{
bool auth = false;
Expand Down
2 changes: 1 addition & 1 deletion src/host/HostShareNUMA.cc
Original file line number Diff line number Diff line change
Expand Up @@ -642,7 +642,7 @@ void HostShareNode::set_hugepage(unsigned long size, unsigned int nr,
return;
}

HugePage h = {size, nr, fr, usage};
HugePage h = {size, nr, fr, usage, 0};

pages.insert(make_pair(h.size_kb, h));

Expand Down
4 changes: 3 additions & 1 deletion src/rm/RequestManager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -219,9 +219,11 @@ int RequestManager::setup_socket()
int rc;
int yes = 1;

struct addrinfo hints = {0};
struct addrinfo hints;
struct addrinfo * result;

memset(&hints, 0, sizeof hints);

hints.ai_family = AF_UNSPEC;
hints.ai_socktype = SOCK_STREAM;
hints.ai_flags = AI_PASSIVE;
Expand Down
8 changes: 4 additions & 4 deletions src/vnm/AddressRange.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1525,7 +1525,7 @@ int AddressRange::free_addr(PoolObjectSQL::ObjectType ot, int obid,

unsigned int index = mac_i[0] - mac[0];

if (index < 0 || index >= size)
if ( mac[0] > mac_i[0] || index >= size)
{
return -1;
}
Expand Down Expand Up @@ -1561,7 +1561,7 @@ int AddressRange::free_addr_by_ip(PoolObjectSQL::ObjectType ot, int obid,

unsigned int index = ip_i - ip;

if (index < 0 || index >= size)
if (ip > ip_i || index >= size)
{
return -1;
}
Expand Down Expand Up @@ -1596,7 +1596,7 @@ int AddressRange::free_addr_by_ip6(PoolObjectSQL::ObjectType ot, int obid,

unsigned int index = ip_i[0] - ip6[0];

if (index < 0 || index >= size || ip6[3] != ip_i[3] || ip6[2] != ip_i[2]
if (ip6[0] > ip_i[0] || index >= size || ip6[3] != ip_i[3] || ip6[2] != ip_i[2]
|| ip6[1] != ip_i[1])
{
return -1;
Expand Down Expand Up @@ -1663,7 +1663,7 @@ int AddressRange::free_addr_by_range(PoolObjectSQL::ObjectType ot, int obid,

string error_msg;

if ((0 <= index) && (index < size))
if ((mac[0] <= mac_i[0]) && (index < size))
{
map<unsigned int, long long>::iterator it = allocated.find(index);

Expand Down

0 comments on commit 22ff32e

Please sign in to comment.