From d0e99ecc197ace3cf9a9b06d692c029c96d4519b Mon Sep 17 00:00:00 2001 From: Christopher Faylor Date: Fri, 18 Dec 2009 03:34:59 +0000 Subject: * ps.cc (main): Return 0 if pid found. --- winsup/utils/ps.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'winsup/utils/ps.cc') diff --git a/winsup/utils/ps.cc b/winsup/utils/ps.cc index bd7879bf6..0b317d2d8 100644 --- a/winsup/utils/ps.cc +++ b/winsup/utils/ps.cc @@ -258,6 +258,7 @@ main (int argc, char *argv[]) { external_pinfo *p; int aflag, lflag, fflag, sflag, uid, proc_id; + bool found_proc_id = true; cygwin_getinfo_types query = CW_GETPINFO; const char *dtitle = " PID TTY STIME COMMAND\n"; const char *dfmt = "%7d%4s%10s %s\n"; @@ -299,6 +300,7 @@ main (int argc, char *argv[]) case 'p': proc_id = atoi (optarg); aflag = 1; + found_proc_id = false; break; case 's': sflag = 1; @@ -369,6 +371,8 @@ main (int argc, char *argv[]) { if ((proc_id > 0) && (p->pid != proc_id)) continue; + else + found_proc_id = true; if (aflag) /* nothing to do */; @@ -499,6 +503,5 @@ main (int argc, char *argv[]) } (void) cygwin_internal (CW_UNLOCK_PINFO); - return 0; + return found_proc_id ? 0 : 1; } - -- cgit v1.2.3