diff options
Diffstat (limited to 'usr.sbin/switchd/parse.y')
-rw-r--r-- | usr.sbin/switchd/parse.y | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/usr.sbin/switchd/parse.y b/usr.sbin/switchd/parse.y index 8f051d7a8bb..a365057c5d2 100644 --- a/usr.sbin/switchd/parse.y +++ b/usr.sbin/switchd/parse.y @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.y,v 1.3 2016/10/12 19:07:42 reyk Exp $ */ +/* $OpenBSD: parse.y,v 1.4 2017/01/05 12:42:19 krw Exp $ */ /* * Copyright (c) 2007-2016 Reyk Floeter <reyk@openbsd.org> @@ -634,9 +634,10 @@ symset(const char *nam, const char *val, int persist) { struct sym *sym; - for (sym = TAILQ_FIRST(&symhead); sym && strcmp(nam, sym->nam); - sym = TAILQ_NEXT(sym, entry)) - ; /* nothing */ + TAILQ_FOREACH(sym, &symhead, entry) { + if (strcmp(nam, sym->nam) == 0) + break; + } if (sym != NULL) { if (sym->persist == 1) @@ -695,11 +696,12 @@ symget(const char *nam) { struct sym *sym; - TAILQ_FOREACH(sym, &symhead, entry) + TAILQ_FOREACH(sym, &symhead, entry) { if (strcmp(nam, sym->nam) == 0) { sym->used = 1; return (sym->val); } + } return (NULL); } |