Module Name:    src
Committed By:   kamil
Date:           Sat Apr 14 14:26:20 UTC 2018

Modified Files:
        src/sys/kern: kern_proc.c

Log Message:
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>


To generate a diff of this commit:
cvs rdiff -u -r1.211 -r1.212 src/sys/kern/kern_proc.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/kern/kern_proc.c
diff -u src/sys/kern/kern_proc.c:1.211 src/sys/kern/kern_proc.c:1.212
--- src/sys/kern/kern_proc.c:1.211	Tue Mar 13 02:24:26 2018
+++ src/sys/kern/kern_proc.c	Sat Apr 14 14:26:20 2018
@@ -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 @@ sysctl_doeproc(SYSCTLFN_ARGS)
 	mutex_exit(proc_lock);
 
 	if (where != NULL) {
-		if (needed == 0) {
-			error = ESRCH;
-			goto out;
-		}
 		*oldlenp = dp - where;
 		if (needed > *oldlenp) {
 			error = ENOMEM;

Reply via email to