]> granicus.if.org Git - procps-ng/commitdiff
pgrep:Remove the a?b:c for threads or no threads
authorCraig Small <csmall@enc.com.au>
Sat, 26 Sep 2015 04:47:56 +0000 (14:47 +1000)
committerCraig Small <csmall@enc.com.au>
Sat, 26 Sep 2015 04:47:56 +0000 (14:47 +1000)
pgrep.c

diff --git a/pgrep.c b/pgrep.c
index b5b011a44fc4896027cc4991e01c8174a63e69a6..9e60977c9cce6c5c25aec4840315744ff7790b4f 100644 (file)
--- a/pgrep.c
+++ b/pgrep.c
@@ -489,6 +489,7 @@ static struct el * select_procs (int *num)
     char cmdsearch[CMDSTRSIZE];
     char cmdoutput[CMDSTRSIZE];
     char *task_cmdline;
+    enum pids_reap_type which;
 
     preg = do_regcomp();
 
@@ -505,9 +506,11 @@ static struct el * select_procs (int *num)
     if (procps_pids_new(&info, 11, Items) < 0)
         xerrx(EXIT_FATAL,
               _("Unable to create pid info structure"));
-    if (procps_pids_read_open(info,
-                              ((opt_threads && !i_am_pkill)?
-                               PROCPS_REAP_THREADS_TOO:PROCPS_REAP_TASKS_ONLY)) < 0)
+    if (opt_threads && !i_am_pkill)
+        which = PROCPS_REAP_THREADS_TOO;
+    else
+        which = PROCPS_REAP_TASKS_ONLY;
+    if (procps_pids_read_open(info, which) < 0)
         xerrx(EXIT_FATAL,
               _("Unable to open pids information"));