[PATCH] lib: Cleanup RIB mount name

  • From: Dimitri Staessens <dimitri@ouroboros.rocks>
  • To: ouroboros@xxxxxxxxxxxxx
  • Date: Sat, 26 Feb 2022 14:13:51 +0100

IPCPs would call rib_fini() twice, once after cleaning up their
managed RIB, and once again for the program-generic RIB, which is not
initialized for IPCPs. rib_fini() checked if the mount name was valid,
but it didn't unset it after execution.

Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks>
---
 src/lib/rib.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/lib/rib.c b/src/lib/rib.c
index 27c66f2f..2a21c2cc 100644
--- a/src/lib/rib.c
+++ b/src/lib/rib.c
@@ -338,7 +338,7 @@ int rib_init(const char * mountpt)
         fuse_opt_free_args(&args);
         rmdir(rib.mnt);
  fail_mnt:
-        memset(rib.mnt, 0, RIB_PATH_LEN + 1);
+        memset(rib.mnt, 0, sizeof(rib.mnt));
  fail:
         return -1;
 #else
@@ -377,6 +377,8 @@ void rib_fini(void)
         pthread_rwlock_unlock(&rib.lock);
 
         pthread_rwlock_destroy(&rib.lock);
+
+        memset(rib.mnt, 0, sizeof(rib.mnt));
 #endif
 }
 
-- 
2.35.1


Other related posts:

  • » [PATCH] lib: Cleanup RIB mount name - Dimitri Staessens