Source-Changes-HG archive

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

[src/trunk]: src/sys/kern (sysctl_doeproc): make sure we release the proclist...



details:   https://anonhg.NetBSD.org/src/rev/c65db64385b9
branches:  trunk
changeset: 480602:c65db64385b9
user:      assar <assar%NetBSD.org@localhost>
date:      Sun Jan 16 15:07:48 2000 +0000

description:
(sysctl_doeproc): make sure we release the proclist_lock even if
copyout fails

diffstat:

 sys/kern/kern_sysctl.c |  9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diffs (33 lines):

diff -r 776ae16a3577 -r c65db64385b9 sys/kern/kern_sysctl.c
--- a/sys/kern/kern_sysctl.c    Sun Jan 16 14:24:33 2000 +0000
+++ b/sys/kern/kern_sysctl.c    Sun Jan 16 15:07:48 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_sysctl.c,v 1.55 1999/11/17 23:24:54 is Exp $      */
+/*     $NetBSD: kern_sysctl.c,v 1.56 2000/01/16 15:07:48 assar Exp $   */
 
 /*-
  * Copyright (c) 1982, 1986, 1989, 1993
@@ -1013,11 +1013,11 @@
                        error = copyout((caddr_t)p, &dp->kp_proc,
                                        sizeof(struct proc));
                        if (error)
-                               return (error);
+                               goto cleanup;
                        error = copyout((caddr_t)&eproc, &dp->kp_eproc,
                                        sizeof(eproc));
                        if (error)
-                               return (error);
+                               goto cleanup;
                        dp++;
                        buflen -= sizeof(struct kinfo_proc);
                }
@@ -1037,6 +1037,9 @@
                *sizep = needed;
        }
        return (0);
+ cleanup:
+       proclist_unlock_read();
+       return (error);
 }
 
 /*



Home | Main Index | Thread Index | Old Index