diff --git a/usr.sbin/makefs/cd9660.c b/usr.sbin/makefs/cd9660.c --- a/usr.sbin/makefs/cd9660.c +++ b/usr.sbin/makefs/cd9660.c @@ -1508,10 +1508,10 @@ TAILQ_INSERT_HEAD(&pt_head, n, ptq); /* Breadth-first traversal of file structure */ - while (pt_head.tqh_first != 0) { - n = pt_head.tqh_first; + while (!TAILQ_EMPTY(&pt_head)) { + n = TAILQ_FIRST(&pt_head); dirNode = n->node; - TAILQ_REMOVE(&pt_head, pt_head.tqh_first, ptq); + TAILQ_REMOVE(&pt_head, n, ptq); free(n); /* Update the size */