summaryrefslogtreecommitdiff
path: root/src/cgtop
diff options
context:
space:
mode:
authorMichal Schmidt <mschmidt@redhat.com>2014-10-04 21:29:10 +0200
committerMichal Schmidt <mschmidt@redhat.com>2014-10-23 17:38:02 +0200
commit2d5c93c7af05bfa25cad85909acdb7b0bfc3f4e1 (patch)
treed0413c10f0e323cb9d3e338a9e15770c95e2c856 /src/cgtop
parent8f88aed740ded77af443bb1b7c79bb229b50f8f8 (diff)
install, cgtop: adjust hashmap_move_one() callers for -ENOMEM possibility
That hashmap_move_one() currently cannot fail with -ENOMEM is an implementation detail, which is not possible to guarantee in general. Hashmap implementations based on anything else than chaining of individual entries may have to allocate. hashmap_move_one will not fail with -ENOMEM if a proper reservation has been made beforehand. Use reservations in install.c. In cgtop.c simply propagate the error instead of asserting.
Diffstat (limited to 'src/cgtop')
-rw-r--r--src/cgtop/cgtop.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/cgtop/cgtop.c b/src/cgtop/cgtop.c
index ab8c4cfda..932a7ba7c 100644
--- a/src/cgtop/cgtop.c
+++ b/src/cgtop/cgtop.c
@@ -126,7 +126,9 @@ static int process(const char *controller, const char *path, Hashmap *a, Hashmap
return r;
}
} else {
- assert_se(hashmap_move_one(a, b, path) == 0);
+ r = hashmap_move_one(a, b, path);
+ if (r < 0)
+ return r;
g->cpu_valid = g->memory_valid = g->io_valid = g->n_tasks_valid = false;
}
}