summaryrefslogtreecommitdiffstats
path: root/usr.sbin/ldpd
diff options
context:
space:
mode:
Diffstat (limited to 'usr.sbin/ldpd')
-rw-r--r--usr.sbin/ldpd/control.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/usr.sbin/ldpd/control.c b/usr.sbin/ldpd/control.c
index 4ac6b114b27..b6a209912e7 100644
--- a/usr.sbin/ldpd/control.c
+++ b/usr.sbin/ldpd/control.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: control.c,v 1.27 2016/05/23 19:20:55 renato Exp $ */
+/* $OpenBSD: control.c,v 1.28 2017/01/08 23:04:42 krw Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -150,9 +150,10 @@ control_connbyfd(int fd)
{
struct ctl_conn *c;
- for (c = TAILQ_FIRST(&ctl_conns); c != NULL && c->iev.ibuf.fd != fd;
- c = TAILQ_NEXT(c, entry))
- ; /* nothing */
+ TAILQ_FOREACH(c, &ctl_conns, entry) {
+ if (c->iev.ibuf.fd == fd)
+ break;
+ }
return (c);
}
@@ -162,9 +163,10 @@ control_connbypid(pid_t pid)
{
struct ctl_conn *c;
- for (c = TAILQ_FIRST(&ctl_conns); c != NULL && c->iev.ibuf.pid != pid;
- c = TAILQ_NEXT(c, entry))
- ; /* nothing */
+ TAILQ_FOREACH(c, &ctl_conns, entry) {
+ if (c->iev.ibuf.pid == pid)
+ break;
+ }
return (c);
}