summaryrefslogtreecommitdiffstats
path: root/usr.sbin/ldpd
diff options
context:
space:
mode:
authorkrw <krw@openbsd.org>2017-01-08 23:04:42 +0000
committerkrw <krw@openbsd.org>2017-01-08 23:04:42 +0000
commitc39b72087802b3201e2c1e559c2535a94f4b0249 (patch)
treedd58464e2e2c43ee1473bccc864fcb3a25d64714 /usr.sbin/ldpd
parentIndentation must be measured in units of the surrounding text, (diff)
downloadwireguard-openbsd-c39b72087802b3201e2c1e559c2535a94f4b0249.tar.xz
wireguard-openbsd-c39b72087802b3201e2c1e559c2535a94f4b0249.zip
Replace hand-rolled for(;;) traversal of ctl_conns TAILQ with
TAILQ_FOREACH(). No intentional functional change. ok reyk@
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);
}