summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2015-04-24 19:54:29 +0200
committerLennart Poettering <lennart@poettering.net>2015-04-24 19:56:47 +0200
commit742f41adb1b7251fcdf2201632c2a980282cdcc4 (patch)
treeda9519f102da4d97d76accc728b5cd54e9e41592
parent07cc65c70150faa68a63a444d615f922517c7d94 (diff)
core: minor simplification
-rw-r--r--src/core/unit.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/core/unit.c b/src/core/unit.c
index 730492e226..496db6c4cd 100644
--- a/src/core/unit.c
+++ b/src/core/unit.c
@@ -3643,11 +3643,9 @@ int unit_require_mounts_for(Unit *u, const char *path) {
if (!x) {
char *q;
- if (!u->manager->units_requiring_mounts_for) {
- u->manager->units_requiring_mounts_for = hashmap_new(&string_hash_ops);
- if (!u->manager->units_requiring_mounts_for)
- return -ENOMEM;
- }
+ r = hashmap_ensure_allocated(&u->manager->units_requiring_mounts_for, &string_hash_ops);
+ if (r < 0)
+ return r;
q = strdup(prefix);
if (!q)