[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230719185106.17614-7-gioele@svario.it>
Date: Wed, 19 Jul 2023 20:50:50 +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 06/22] lib/bpf_legacy: bpf_hash_init: Relay returned value
Signed-off-by: Gioele Barabucci <gioele@...rio.it>
---
lib/bpf_legacy.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/lib/bpf_legacy.c b/lib/bpf_legacy.c
index 706820f5..4bb3f7d8 100644
--- a/lib/bpf_legacy.c
+++ b/lib/bpf_legacy.c
@@ -2751,7 +2751,7 @@ static bool bpf_pinning_reserved(uint32_t pinning)
}
}
-static void bpf_hash_init(struct bpf_elf_ctx *ctx, const char *db_file)
+static int bpf_hash_init(struct bpf_elf_ctx *ctx, const char *db_file)
{
struct bpf_hash_entry *entry;
char subpath[PATH_MAX] = {};
@@ -2761,14 +2761,14 @@ static void bpf_hash_init(struct bpf_elf_ctx *ctx, const char *db_file)
fp = fopen(db_file, "r");
if (!fp)
- return;
+ return -errno;
while ((ret = bpf_read_pin_mapping(fp, &pinning, subpath))) {
if (ret == -1) {
fprintf(stderr, "Database %s is corrupted at: %s\n",
db_file, subpath);
fclose(fp);
- return;
+ return -1;
}
if (bpf_pinning_reserved(pinning)) {
@@ -2796,6 +2796,8 @@ static void bpf_hash_init(struct bpf_elf_ctx *ctx, const char *db_file)
}
fclose(fp);
+
+ return 0;
}
static void bpf_hash_destroy(struct bpf_elf_ctx *ctx)
--
2.39.2
Powered by blists - more mailing lists