Skip to content

Commit

Permalink
systemd: Fix sign conversion warning on i686-linux
Browse files Browse the repository at this point in the history
Fixes the following warning by using a static_cast to an int:

  systemd.cc: In function 'void Systemd::init(const std::vector<Rule>&)':
  systemd.cc:211:42: warning: conversion to 'int' from 'size_t' {aka
  'unsigned int'} may change the sign of the result [-Wsign-conversion]
    211 |             int fd = SD_LISTEN_FDS_START + i;
        |                                          ^

Signed-off-by: aszlig <[email protected]>
  • Loading branch information
aszlig committed Aug 4, 2023
1 parent 55cd25f commit 7399376
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/systemd.cc
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ void Systemd::init(const std::vector<Rule> &rules)

std::unordered_set<int> avail_fds;
for (size_t i = 0; i < fd_count; ++i) {
int fd = SD_LISTEN_FDS_START + i;
int fd = static_cast<int>(SD_LISTEN_FDS_START + i);
avail_fds.insert(fd);
all_fds.insert(fd);
}
Expand All @@ -222,7 +222,7 @@ void Systemd::init(const std::vector<Rule> &rules)

size_t elems = std::min(fdnames_size, fd_count);
for (size_t i = 0; i < elems; ++i) {
int fd = SD_LISTEN_FDS_START + i;
int fd = static_cast<int>(SD_LISTEN_FDS_START + i);

if (fdnames[i] == *rule.fd_name) {
bool is_inet = socket_is_inet(fd);
Expand Down

0 comments on commit 7399376

Please sign in to comment.