summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJorge Lucangeli Obes2016-04-25 17:53:09 -0500
committerJorge Lucangeli Obes2016-04-25 17:54:12 -0500
commitc5e7f73bc6708a8b6247c0b4a00e2b72b743c280 (patch)
tree33627ad2a738fdc72830fa44c22e32a9184b5f46 /toolbox
parentad2021a1b1144f8b307c11ff0a8b47fd85c3cc7a (diff)
downloadplatform-system-core-c5e7f73bc6708a8b6247c0b4a00e2b72b743c280.tar.gz
platform-system-core-c5e7f73bc6708a8b6247c0b4a00e2b72b743c280.tar.xz
platform-system-core-c5e7f73bc6708a8b6247c0b4a00e2b72b743c280.zip
Fix 'ps --ppid'.
Currently, 'ps' will segfault when called with '--ppid' and no argument. Make it return an error instead. Bug: 28383024 Change-Id: I71f2d1ba9502996ae75b17605234eb99ebb589f2
Diffstat (limited to 'toolbox')
-rw-r--r--toolbox/ps.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/toolbox/ps.c b/toolbox/ps.c
index d366f3ecf..633c48ea5 100644
--- a/toolbox/ps.c
+++ b/toolbox/ps.c
@@ -282,6 +282,13 @@ int ps_main(int argc, char **argv)
282 } else if(!strcmp(argv[1],"--abi")) { 282 } else if(!strcmp(argv[1],"--abi")) {
283 display_flags |= SHOW_ABI; 283 display_flags |= SHOW_ABI;
284 } else if(!strcmp(argv[1],"--ppid")) { 284 } else if(!strcmp(argv[1],"--ppid")) {
285 if (argc < 3) {
286 /* Bug 26554285: Use printf because some apps require at least
287 * one line of output to stdout even for errors.
288 */
289 printf("no ppid\n");
290 return 1;
291 }
285 ppid_filter = atoi(argv[2]); 292 ppid_filter = atoi(argv[2]);
286 if (ppid_filter == 0) { 293 if (ppid_filter == 0) {
287 /* Bug 26554285: Use printf because some apps require at least 294 /* Bug 26554285: Use printf because some apps require at least