From owner-svn-src-all@FreeBSD.ORG Tue Jul 3 08:46:27 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 389A2106566C; Tue, 3 Jul 2012 08:46:27 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 237488FC08; Tue, 3 Jul 2012 08:46:27 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q638kQO5032010; Tue, 3 Jul 2012 08:46:27 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q638kQD6032008; Tue, 3 Jul 2012 08:46:26 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201207030846.q638kQD6032008@svn.freebsd.org> From: Konstantin Belousov Date: Tue, 3 Jul 2012 08:46:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238064 - stable/8/usr.bin/killall X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Jul 2012 08:46:27 -0000 Author: kib Date: Tue Jul 3 08:46:26 2012 New Revision: 238064 URL: http://svn.freebsd.org/changeset/base/238064 Log: MFC r237844, r237845, r237846: Minor tweaks. Modified: stable/8/usr.bin/killall/killall.c Directory Properties: stable/8/usr.bin/killall/ (props changed) Modified: stable/8/usr.bin/killall/killall.c ============================================================================== --- stable/8/usr.bin/killall/killall.c Tue Jul 3 08:42:48 2012 (r238063) +++ stable/8/usr.bin/killall/killall.c Tue Jul 3 08:46:26 2012 (r238064) @@ -102,7 +102,7 @@ nosig(char *name) int main(int ac, char **av) { - struct kinfo_proc *procs = NULL, *newprocs; + struct kinfo_proc *procs, *newprocs; struct stat sb; struct passwd *pw; regex_t rgx; @@ -285,9 +285,6 @@ main(int ac, char **av) size = 0; mib[0] = CTL_KERN; mib[1] = KERN_PROC; - mib[2] = KERN_PROC_PROC; - mib[3] = 0; - miblen = 3; if (user) { mib[2] = eflag ? KERN_PROC_UID : KERN_PROC_RUID; @@ -297,16 +294,20 @@ main(int ac, char **av) mib[2] = KERN_PROC_TTY; mib[3] = tdev; miblen = 4; + } else { + mib[2] = KERN_PROC_PROC; + mib[3] = 0; + miblen = 3; } + procs = NULL; st = sysctl(mib, miblen, NULL, &size, NULL, 0); do { size += size / 10; newprocs = realloc(procs, size); - if (newprocs == 0) { - if (procs) - free(procs); - errx(1, "could not reallocate memory"); + if (newprocs == NULL) { + free(procs); + err(1, "could not reallocate memory"); } procs = newprocs; st = sysctl(mib, miblen, procs, &size, NULL, 0); @@ -316,7 +317,7 @@ main(int ac, char **av) if (size % sizeof(struct kinfo_proc) != 0) { fprintf(stderr, "proc size mismatch (%zu total, %zu chunks)\n", size, sizeof(struct kinfo_proc)); - fprintf(stderr, "userland out of sync with kernel, recompile libkvm etc\n"); + fprintf(stderr, "userland out of sync with kernel\n"); exit(1); } nprocs = size / sizeof(struct kinfo_proc);