summaryrefslogtreecommitdiff
path: root/src/shared
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2015-01-22 18:54:48 +0100
committerLennart Poettering <lennart@poettering.net>2015-01-22 18:54:48 +0100
commit3637713a2006320a8844adc6de5cd134444bb329 (patch)
tree49dc9054c8e0d3725e0ae00923aca35c1b8e13a8 /src/shared
parent57d8a552af020a4dee034e2fd67782c3d8128f58 (diff)
cgroup-show: don't hit assert, when the extra pids array is empty
Diffstat (limited to 'src/shared')
-rw-r--r--src/shared/cgroup-show.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/shared/cgroup-show.c b/src/shared/cgroup-show.c
index 1e14ba6ddb..d1132779aa 100644
--- a/src/shared/cgroup-show.c
+++ b/src/shared/cgroup-show.c
@@ -43,7 +43,9 @@ static int compare(const void *a, const void *b) {
static void show_pid_array(pid_t pids[], unsigned n_pids, const char *prefix, unsigned n_columns, bool extra, bool more, bool kernel_threads, OutputFlags flags) {
unsigned i, j, pid_width;
- assert(n_pids > 0);
+ if (n_pids <= 0)
+ return;
+
qsort(pids, n_pids, sizeof(pid_t), compare);
/* Filter duplicates */