X-Git-Url: https://git.tcpdump.org/tcpdump/blobdiff_plain/b9bc936cc68384c196a2093b97052ea9817f52d9..ad87e9495c5c5ecdbb38b7ad76e9c54d7e9852ac:/util.c diff --git a/util.c b/util.c index 2310a7d9..a5f275e9 100644 --- a/util.c +++ b/util.c @@ -21,7 +21,7 @@ #ifndef lint static const char rcsid[] _U_ = - "@(#) $Header: /tcpdump/master/tcpdump/util.c,v 1.95 2005-03-21 11:35:55 hannes Exp $ (LBL)"; + "@(#) $Header: /tcpdump/master/tcpdump/util.c,v 1.96 2005-04-25 16:14:43 guy Exp $ (LBL)"; #endif #ifdef HAVE_CONFIG_H @@ -219,10 +219,12 @@ const char * tok2strbuf(register const struct tok *lp, register const char *fmt, register int v, char *buf, size_t bufsize) { - while (lp->s != NULL && lp != NULL) { - if (lp->v == v) - return (lp->s); - ++lp; + if (lp != NULL) { + while (lp->s != NULL) { + if (lp->v == v) + return (lp->s); + ++lp; + } } if (fmt == NULL) fmt = "#%d";