summaryrefslogtreecommitdiff
path: root/src/basic/af-list.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/basic/af-list.c')
-rw-r--r--src/basic/af-list.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/basic/af-list.c b/src/basic/af-list.c
index 866a1d4317..abad221d58 100644
--- a/src/basic/af-list.c
+++ b/src/basic/af-list.c
@@ -1,5 +1,6 @@
/* SPDX-License-Identifier: LGPL-2.1+ */
+#include <errno.h>
#include <string.h>
#include <sys/socket.h>
@@ -16,7 +17,7 @@ const char *af_to_name(int id) {
if (id <= 0)
return NULL;
- if (id >= (int) ELEMENTSOF(af_names))
+ if ((size_t) id >= ELEMENTSOF(af_names))
return NULL;
return af_names[id];
@@ -29,7 +30,7 @@ int af_from_name(const char *name) {
sc = lookup_af(name, strlen(name));
if (!sc)
- return AF_UNSPEC;
+ return -EINVAL;
return sc->id;
}