summaryrefslogtreecommitdiff
path: root/src/shared/cgroup-show.c
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2013-10-14 19:15:24 -0400
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2013-10-14 19:16:25 -0400
commita0551d26ab5c6e0d5089b42a6319baef0e28ad92 (patch)
tree1131d7a0d4c8d3bc6f4b22226164b06d87483156 /src/shared/cgroup-show.c
parent68313d3dfa2082dae8a06643d639e0200afc19fc (diff)
Fix bad assert in show_pid_array
This function should get the same treatment as other qsort uses did in 7ff7394 "Never call qsort on potentially NULL arrays". Reported-by: Oleksii Shevchuk <alxchk@gmail.com>
Diffstat (limited to 'src/shared/cgroup-show.c')
-rw-r--r--src/shared/cgroup-show.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/src/shared/cgroup-show.c b/src/shared/cgroup-show.c
index 979fa8fddf..ce02b76e36 100644
--- a/src/shared/cgroup-show.c
+++ b/src/shared/cgroup-show.c
@@ -44,8 +44,6 @@ static void show_pid_array(int pids[], unsigned n_pids, const char *prefix, unsi
unsigned i, m, pid_width;
pid_t biggest = 0;
- assert(n_pids > 0);
-
/* Filter duplicates */
m = 0;
for (i = 0; i < n_pids; i++) {
@@ -65,7 +63,7 @@ static void show_pid_array(int pids[], unsigned n_pids, const char *prefix, unsi
pid_width = DECIMAL_STR_WIDTH(biggest);
/* And sort */
- qsort(pids, n_pids, sizeof(pid_t), compare);
+ qsort_safe(pids, n_pids, sizeof(pid_t), compare);
if (flags & OUTPUT_FULL_WIDTH)
n_columns = 0;