summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorOpenGnSys Support Team <soporte-og@soleta.eu>2024-10-01 12:35:13 +0200
committerOpenGnSys Support Team <soporte-og@soleta.eu>2024-10-01 12:35:13 +0200
commit89ba3f1b4f1688e56a34adc4ae0b24971ba6649c (patch)
treef9d4b435e0fa6610d7c0cbdd5cf33ca439f32dc5 /src
parente81685bba0d9f1d6a28c0375f118df57667bedf0 (diff)
src: inet_aton() returns 0 on error
not < 0, fix this.
Diffstat (limited to 'src')
-rw-r--r--src/dbi.c12
-rw-r--r--src/repo.c2
-rw-r--r--src/rest.c6
3 files changed, 10 insertions, 10 deletions
diff --git a/src/dbi.c b/src/dbi.c
index 0b5bbbb..3122bce 100644
--- a/src/dbi.c
+++ b/src/dbi.c
@@ -275,7 +275,7 @@ int og_dbi_get_server_ip(const struct og_dbi *dbi, const char *client_ip,
bool found = false;
dbi_result result;
- if (inet_aton(client_ip, &client) < 0) {
+ if (!inet_aton(client_ip, &client)) {
syslog(LOG_ERR, "failed to parse client IP (%s:%d)\n",
__func__, __LINE__);
return -1;
@@ -300,7 +300,7 @@ int og_dbi_get_server_ip(const struct og_dbi *dbi, const char *client_ip,
}
netmask_ip = dbi_result_get_string(result, "netmask");
- if (inet_aton(netmask_ip, &netmask) < 0) {
+ if (!inet_aton(netmask_ip, &netmask)) {
syslog(LOG_ERR, "failed to parse netmask (%s:%d)\n",
__func__, __LINE__);
dbi_result_free(result);
@@ -324,7 +324,7 @@ int og_dbi_get_server_ip(const struct og_dbi *dbi, const char *client_ip,
if (server_ip[0] && !first_server_ip)
first_server_ip = server_ip;
- if (inet_aton(server_ip, &server) < 0) {
+ if (!inet_aton(server_ip, &server)) {
syslog(LOG_ERR, "failed to get repository IP (%s:%d)\n",
__func__, __LINE__);
dbi_result_free(result);
@@ -369,7 +369,7 @@ int og_dbi_get_repository_ip(const struct og_dbi *dbi, const uint32_t repo_id,
bool found = false;
dbi_result result;
- if (inet_aton(client_ip, &client) < 0) {
+ if (!inet_aton(client_ip, &client)) {
syslog(LOG_ERR, "failed to parse client IP (%s:%d)\n",
__func__, __LINE__);
return -1;
@@ -394,7 +394,7 @@ int og_dbi_get_repository_ip(const struct og_dbi *dbi, const uint32_t repo_id,
}
netmask_ip = dbi_result_get_string(result, "netmask");
- if (inet_aton(netmask_ip, &netmask) < 0) {
+ if (!inet_aton(netmask_ip, &netmask)) {
syslog(LOG_ERR, "failed to parse netmask (%s:%d)\n",
__func__, __LINE__);
dbi_result_free(result);
@@ -419,7 +419,7 @@ int og_dbi_get_repository_ip(const struct og_dbi *dbi, const uint32_t repo_id,
if (repo_ip[0] && !first_repo_ip)
first_repo_ip = repo_ip;
- if (inet_aton(repo_ip, &repo) < 0) {
+ if (!inet_aton(repo_ip, &repo)) {
syslog(LOG_ERR, "failed to get repository IP (%s:%d)\n",
__func__, __LINE__);
dbi_result_free(result);
diff --git a/src/repo.c b/src/repo.c
index d2b55cb..362a55e 100644
--- a/src/repo.c
+++ b/src/repo.c
@@ -91,7 +91,7 @@ int og_repo_list(struct list_head *repo_list)
name = dbi_result_get_string(result, "nombrerepositorio");
alias = dbi_result_get_ulonglong(result, "alias");
- if (inet_aton(ip, &addr) < 0) {
+ if (!inet_aton(ip, &addr)) {
syslog(LOG_ERR, "malformed IP in repo %s\n", name);
goto err_repo_list;
}
diff --git a/src/rest.c b/src/rest.c
index a9eae33..f33486c 100644
--- a/src/rest.c
+++ b/src/rest.c
@@ -603,7 +603,7 @@ static int og_cmd_wol(json_t *element, struct og_msg_params *params)
if (og_client_find(new_params.ips_array[i]))
continue;
- if (inet_aton(new_params.ips_array[i], &addr) < 0)
+ if (!inet_aton(new_params.ips_array[i], &addr))
continue;
cli_wol = og_client_wol_find(&addr);
@@ -618,7 +618,7 @@ static int og_cmd_wol(json_t *element, struct og_msg_params *params)
list_add_tail(&cli_wol->list, &client_wol_list);
- if (inet_aton(new_params.netmask_array[i], &netmask) < 0)
+ if (!inet_aton(new_params.netmask_array[i], &netmask))
continue;
if (wake_up(sd, &addr, &netmask, new_params.mac_array[i],
@@ -2011,7 +2011,7 @@ static int og_cmd_get_client_info(json_t *element,
if (!og_msg_params_validate(params, OG_REST_PARAM_ADDR))
return -1;
- if (inet_aton(params->ips_array[0], &addr) == 0)
+ if (!inet_aton(params->ips_array[0], &addr))
return -1;
dbi = og_dbi_open(&ogconfig.db);