aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2009-12-18 03:34:59 +0000
committerChristopher Faylor <me@cgf.cx>2009-12-18 03:34:59 +0000
commitd0e99ecc197ace3cf9a9b06d692c029c96d4519b (patch)
tree97519dd9562e973f5be496b9cf1d9a91d4057d67
parentb292054cac7f3b99d02b49987e7d435c6edb90a7 (diff)
downloadnewlib-d0e99ecc197ace3cf9a9b06d692c029c96d4519b.zip
newlib-d0e99ecc197ace3cf9a9b06d692c029c96d4519b.tar.gz
newlib-d0e99ecc197ace3cf9a9b06d692c029c96d4519b.tar.bz2
* ps.cc (main): Return 0 if pid found.
-rw-r--r--winsup/utils/ChangeLog4
-rw-r--r--winsup/utils/ps.cc7
2 files changed, 9 insertions, 2 deletions
diff --git a/winsup/utils/ChangeLog b/winsup/utils/ChangeLog
index 6cce542..727817b 100644
--- a/winsup/utils/ChangeLog
+++ b/winsup/utils/ChangeLog
@@ -1,3 +1,7 @@
+2009-12-17 Christopher Faylor <me+cygwin@cgf.cx>
+
+ * ps.cc (main): Return 0 if pid found.
+
2009-12-16 Corinna Vinschen <corinna@vinschen.de>
* regtool.cc: Throughout, convert all registry calls to wide char
diff --git a/winsup/utils/ps.cc b/winsup/utils/ps.cc
index bd7879b..0b317d2 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;
}
-