]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
core: change mount_synthesize_root() return to int 4481/head
authorLennart Poettering <lennart@poettering.net>
Wed, 2 Nov 2016 17:38:12 +0000 (11:38 -0600)
committerLennart Poettering <lennart@poettering.net>
Wed, 2 Nov 2016 17:39:49 +0000 (11:39 -0600)
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.

src/core/mount.c

index 0641621d8fea660c611572c44a427dcf8e1a7753..d749e49df5b37f719f4cd8d48008fb4dd2cff46a 100644 (file)
@@ -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);