summaryrefslogtreecommitdiffstats
path: root/ldpd/accept.c
diff options
context:
space:
mode:
authorQuentin Young <qlyoung@cumulusnetworks.com>2017-05-05 23:22:25 +0200
committerQuentin Young <qlyoung@cumulusnetworks.com>2017-05-09 22:44:22 +0200
commit66e78ae64bc4659848517953b365606e3e70e878 (patch)
treeef1339e397feed2b56b8d653d41c03aa5b2bd94f /ldpd/accept.c
parentlib: safely check & set thread pointers (diff)
downloadfrr-66e78ae64bc4659848517953b365606e3e70e878.tar.xz
frr-66e78ae64bc4659848517953b365606e3e70e878.zip
*: update thread_add_* calls
Pass pointer to pointer instead of assigning by return value. See previous commit message. To ensure that the behavior stays functionally correct, any assignments with the result of a thread_add* function have been transformed to set the pointer to null before passing it. These can be removed wherever the pointer is known to already be null. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
Diffstat (limited to 'ldpd/accept.c')
-rw-r--r--ldpd/accept.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/ldpd/accept.c b/ldpd/accept.c
index 5b1dacc30..323558d7f 100644
--- a/ldpd/accept.c
+++ b/ldpd/accept.c
@@ -58,7 +58,8 @@ accept_add(int fd, int (*cb)(struct thread *), void *arg)
av->arg = arg;
LIST_INSERT_HEAD(&accept_queue.queue, av, entry);
- av->ev = thread_add_read(master, accept_cb, av, av->fd, NULL);
+ av->ev = NULL;
+ thread_add_read(master, accept_cb, av, av->fd, &av->ev);
log_debug("%s: accepting on fd %d", __func__, fd);
@@ -85,8 +86,8 @@ accept_pause(void)
{
log_debug(__func__);
accept_unarm();
- accept_queue.evt = thread_add_timer(master, accept_timeout, NULL, 1,
- NULL);
+ accept_queue.evt = NULL;
+ thread_add_timer(master, accept_timeout, NULL, 1, &accept_queue.evt);
}
void
@@ -103,8 +104,10 @@ static void
accept_arm(void)
{
struct accept_ev *av;
- LIST_FOREACH(av, &accept_queue.queue, entry)
- av->ev = thread_add_read(master, accept_cb, av, av->fd, NULL);
+ LIST_FOREACH(av, &accept_queue.queue, entry) {
+ av->ev = NULL;
+ thread_add_read(master, accept_cb, av, av->fd, &av->ev);
+ }
}
static void
@@ -119,7 +122,8 @@ static int
accept_cb(struct thread *thread)
{
struct accept_ev *av = THREAD_ARG(thread);
- av->ev = thread_add_read(master, accept_cb, av, av->fd, NULL);
+ av->ev = NULL;
+ thread_add_read(master, accept_cb, av, av->fd, &av->ev);
av->accept_cb(thread);
return (0);