summaryrefslogtreecommitdiff
path: root/zebra/zebra_netns_notify.c
diff options
context:
space:
mode:
authorIgor Ryzhov <iryzhov@nfware.com>2021-10-06 22:06:23 +0300
committerIgor Ryzhov <iryzhov@nfware.com>2021-10-20 20:07:15 +0300
commitee1455dd983e2b19018890c2da5e22bb97b3adb7 (patch)
tree2ad4cece5e23cd14e95073f5d35549d61b3e0b8b /zebra/zebra_netns_notify.c
parent5db95752c063a46a6ee8cdf5e65d45c68a8de77f (diff)
lib: change thread_add_* API
Do not return pointer to the newly created thread from various thread_add functions. This should prevent developers from storing a thread pointer into some variable without letting the lib know that the pointer is stored. When the lib doesn't know that the pointer is stored, it doesn't prevent rescheduling and it can lead to hard to find bugs. If someone wants to store the pointer, they should pass a double pointer as the last argument. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
Diffstat (limited to 'zebra/zebra_netns_notify.c')
-rw-r--r--zebra/zebra_netns_notify.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/zebra/zebra_netns_notify.c b/zebra/zebra_netns_notify.c
index 61f97ce6a9..2d25801590 100644
--- a/zebra/zebra_netns_notify.c
+++ b/zebra/zebra_netns_notify.c
@@ -249,8 +249,8 @@ static int zebra_ns_notify_read(struct thread *t)
char buf[BUFSIZ];
ssize_t len;
- zebra_netns_notify_current = thread_add_read(
- zrouter.master, zebra_ns_notify_read, NULL, fd_monitor, NULL);
+ thread_add_read(zrouter.master, zebra_ns_notify_read, NULL, fd_monitor,
+ &zebra_netns_notify_current);
len = read(fd_monitor, buf, sizeof(buf));
if (len < 0) {
flog_err_sys(EC_ZEBRA_NS_NOTIFY_READ,
@@ -359,8 +359,8 @@ void zebra_ns_notify_init(void)
"NS notify watch: failed to add watch (%s)",
safe_strerror(errno));
}
- zebra_netns_notify_current = thread_add_read(
- zrouter.master, zebra_ns_notify_read, NULL, fd_monitor, NULL);
+ thread_add_read(zrouter.master, zebra_ns_notify_read, NULL, fd_monitor,
+ &zebra_netns_notify_current);
}
void zebra_ns_notify_close(void)