Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/kern siggetinfo: use TAILQ_FOREACH_SAFE as the element g...



details:   https://anonhg.NetBSD.org/src/rev/dbfa0919491c
branches:  trunk
changeset: 817479:dbfa0919491c
user:      hannken <hannken%NetBSD.org@localhost>
date:      Sun Aug 21 15:24:17 2016 +0000

description:
siggetinfo: use TAILQ_FOREACH_SAFE as the element gets removed from the list.

diffstat:

 sys/kern/kern_sig.c |  8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diffs (35 lines):

diff -r 1b9c9d9ceb64 -r dbfa0919491c sys/kern/kern_sig.c
--- a/sys/kern/kern_sig.c       Sun Aug 21 13:23:36 2016 +0000
+++ b/sys/kern/kern_sig.c       Sun Aug 21 15:24:17 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_sig.c,v 1.328 2016/08/04 06:43:43 christos Exp $  */
+/*     $NetBSD: kern_sig.c,v 1.329 2016/08/21 15:24:17 hannken Exp $   */
 
 /*-
  * Copyright (c) 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -70,7 +70,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_sig.c,v 1.328 2016/08/04 06:43:43 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_sig.c,v 1.329 2016/08/21 15:24:17 hannken Exp $");
 
 #include "opt_ptrace.h"
 #include "opt_dtrace.h"
@@ -527,14 +527,14 @@
 static int
 siggetinfo(sigpend_t *sp, ksiginfo_t *out, int signo)
 {
-       ksiginfo_t *ksi;
+       ksiginfo_t *ksi, *nksi;
 
        if (sp == NULL)
                goto out;
 
        /* Find siginfo and copy it out. */
        int count = 0;
-       TAILQ_FOREACH(ksi, &sp->sp_info, ksi_list) {
+       TAILQ_FOREACH_SAFE(ksi, &sp->sp_info, ksi_list, nksi) {
                if (ksi->ksi_signo != signo)
                        continue;
                if (count++ > 0) /* Only remove the first, count all of them */



Home | Main Index | Thread Index | Old Index