Source-Changes-HG archive

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

src: Don't set errno ESRCH for empty result of KINFO_PROC[2]



details:   https://anonhg.NetBSD.org/src/rev/58ca44f0473d
branches:  trunk
changeset: 318174:58ca44f0473d
user:      kamil <kamil%NetBSD.org@localhost>
date:      Sat Apr 14 14:26:20 2018 +0000
description:
Don't set errno ESRCH for empty result of KINFO_PROC[2]

Restore the previous behavior as it's prefered.

This new behavior was introduced in 1.210.

Code should check for length of the result.

Requested by <mlelstv>

diffstat:

 sys/kern/kern_proc.c |  8 ++------
 1 files changed, 2 insertions(+), 6 deletions(-)

diffs (29 lines):

diff -r 23cdd1d5cb43 -r 58ca44f0473d sys/kern/kern_proc.c
--- a/sys/kern/kern_proc.c      Sat Apr 14 08:13:58 2018 +0000
+++ b/sys/kern/kern_proc.c      Sat Apr 14 14:26:20 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_proc.c,v 1.211 2018/03/13 02:24:26 kamil Exp $    */
+/*     $NetBSD: kern_proc.c,v 1.212 2018/04/14 14:26:20 kamil Exp $    */
 
 /*-
  * Copyright (c) 1999, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_proc.c,v 1.211 2018/03/13 02:24:26 kamil Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_proc.c,v 1.212 2018/04/14 14:26:20 kamil Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_kstack.h"
@@ -1834,10 +1834,6 @@
        mutex_exit(proc_lock);
 
        if (where != NULL) {
-               if (needed == 0) {
-                       error = ESRCH;
-                       goto out;
-               }
                *oldlenp = dp - where;
                if (needed > *oldlenp) {
                        error = ENOMEM;



Home | Main Index | Thread Index | Old Index