summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2016-11-02 11:38:12 -0600
committerLennart Poettering <lennart@poettering.net>2016-11-02 11:39:49 -0600
commit1201cae704c6674fde2c23fdd7feab8493a20159 (patch)
tree01f1ce620a3b5474360ff1cc6c79cb0eda6a0bf4
parentc69305ff4fe5a182cd58b66077f3db7bc7c222e1 (diff)
core: change mount_synthesize_root() return to int
Let's propagate the error here, instead of eating it up early. In a later change we should probably also change mount_enumerate() to propagate errors up, but that would mean we'd have to change the unit vtable, and thus change all unit types, hence is quite an invasive change.
-rw-r--r--src/core/mount.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/core/mount.c b/src/core/mount.c
index 0641621d8f..d749e49df5 100644
--- a/src/core/mount.c
+++ b/src/core/mount.c
@@ -1599,7 +1599,7 @@ static int mount_get_timeout(Unit *u, usec_t *timeout) {
return 1;
}
-static void synthesize_root_mount(Manager *m) {
+static int synthesize_root_mount(Manager *m) {
Unit *u;
int r;
@@ -1611,10 +1611,8 @@ static void synthesize_root_mount(Manager *m) {
u = manager_get_unit(m, SPECIAL_ROOT_MOUNT);
if (!u) {
r = unit_new_for_name(m, sizeof(Mount), SPECIAL_ROOT_MOUNT, &u);
- if (r < 0) {
- log_error_errno(r, "Failed to allocate the special " SPECIAL_ROOT_MOUNT " unit: %m");
- return;
- }
+ if (r < 0)
+ return log_error_errno(r, "Failed to allocate the special " SPECIAL_ROOT_MOUNT " unit: %m");
}
u->perpetual = true;
@@ -1622,6 +1620,8 @@ static void synthesize_root_mount(Manager *m) {
unit_add_to_load_queue(u);
unit_add_to_dbus_queue(u);
+
+ return 0;
}
static bool mount_is_mounted(Mount *m) {
@@ -1635,7 +1635,9 @@ static void mount_enumerate(Manager *m) {
assert(m);
- synthesize_root_mount(m);
+ r = synthesize_root_mount(m);
+ if (r < 0)
+ goto fail;
mnt_init_debug(0);