summaryrefslogtreecommitdiffstats
path: root/src/dbi.c
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/dbi.c
parente81685bba0d9f1d6a28c0375f118df57667bedf0 (diff)
src: inet_aton() returns 0 on error
not < 0, fix this.
Diffstat (limited to 'src/dbi.c')
-rw-r--r--src/dbi.c12
1 files changed, 6 insertions, 6 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);