[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230719185106.17614-10-gioele@svario.it>
Date: Wed, 19 Jul 2023 20:50:53 +0200
From: Gioele Barabucci <gioele@...rio.it>
To: netdev@...r.kernel.org
Cc: Stephen Hemminger <stephen@...workplumber.org>,
Gioele Barabucci <gioele@...rio.it>
Subject: [iproute2 09/22] lib/rt_names: rtnl_tab_initialize: Relay returned value
Signed-off-by: Gioele Barabucci <gioele@...rio.it>
---
lib/rt_names.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/lib/rt_names.c b/lib/rt_names.c
index 27aca3ec..f64602b5 100644
--- a/lib/rt_names.c
+++ b/lib/rt_names.c
@@ -96,7 +96,7 @@ rtnl_hash_initialize(const char *file, struct rtnl_hash_entry **hash, int size)
return 0;
}
-static void rtnl_tab_initialize(const char *file, char **tab, int size)
+static int rtnl_tab_initialize(const char *file, char **tab, int size)
{
FILE *fp;
int id;
@@ -105,14 +105,14 @@ static void rtnl_tab_initialize(const char *file, char **tab, int size)
fp = fopen(file, "r");
if (!fp)
- return;
+ return -errno;
while ((ret = fread_id_name(fp, &id, &namebuf[0]))) {
if (ret == -1) {
fprintf(stderr, "Database %s is corrupted at %s\n",
file, namebuf);
fclose(fp);
- return;
+ return -1;
}
if (id < 0 || id > size)
continue;
@@ -120,6 +120,8 @@ static void rtnl_tab_initialize(const char *file, char **tab, int size)
tab[id] = strdup(namebuf);
}
fclose(fp);
+
+ return 0;
}
static char *rtnl_rtprot_tab[256] = {
--
2.39.2
Powered by blists - more mailing lists