]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
core: change type of distribute_fds() prototype to return void
authorLennart Poettering <lennart@poettering.net>
Tue, 10 Nov 2015 19:42:58 +0000 (20:42 +0100)
committerLennart Poettering <lennart@poettering.net>
Tue, 10 Nov 2015 20:03:49 +0000 (21:03 +0100)
We can't handle errors of thisc all sanely anyway, and we never actually
return any errors from the unit type that implements the call.  Hence,
let's make this void, in order to simplify things.

src/core/manager.c
src/core/socket.c
src/core/unit.h

index dbe11c2b4d177120074d685850a4ff28fa95dbf3..f712ac29dcf367768c9e925820d90f80001a304d 100644 (file)
@@ -1094,10 +1094,9 @@ fail:
 }
 
 
-static int manager_distribute_fds(Manager *m, FDSet *fds) {
-        Unit *u;
+static void manager_distribute_fds(Manager *m, FDSet *fds) {
         Iterator i;
-        int r;
+        Unit *u;
 
         assert(m);
 
@@ -1106,14 +1105,11 @@ static int manager_distribute_fds(Manager *m, FDSet *fds) {
                 if (fdset_size(fds) <= 0)
                         break;
 
-                if (UNIT_VTABLE(u)->distribute_fds) {
-                        r = UNIT_VTABLE(u)->distribute_fds(u, fds);
-                        if (r < 0)
-                                return r;
-                }
-        }
+                if (!UNIT_VTABLE(u)->distribute_fds)
+                        continue;
 
-        return 0;
+                UNIT_VTABLE(u)->distribute_fds(u, fds);
+        }
 }
 
 int manager_startup(Manager *m, FILE *serialization, FDSet *fds) {
@@ -1157,11 +1153,7 @@ int manager_startup(Manager *m, FILE *serialization, FDSet *fds) {
          * useful to allow container managers to pass some file
          * descriptors to us pre-initialized. This enables
          * socket-based activation of entire containers. */
-        if (fdset_size(fds) > 0) {
-                q = manager_distribute_fds(m, fds);
-                if (q < 0 && r == 0)
-                        r = q;
-        }
+        manager_distribute_fds(m, fds);
 
         /* We might have deserialized the notify fd, but if we didn't
          * then let's create the bus now */
index 3c7f972fbc473889d4c024a0780c16df18c8afc8..c73ee78b139a1b27379ef218c5f0e4ce43dc6692 100644 (file)
@@ -2332,7 +2332,7 @@ static int socket_deserialize_item(Unit *u, const char *key, const char *value,
         return 0;
 }
 
-static int socket_distribute_fds(Unit *u, FDSet *fds) {
+static void socket_distribute_fds(Unit *u, FDSet *fds) {
         Socket *s = SOCKET(u);
         SocketPort *p;
 
@@ -2356,8 +2356,6 @@ static int socket_distribute_fds(Unit *u, FDSet *fds) {
                         }
                 }
         }
-
-        return 0;
 }
 
 _pure_ static UnitActiveState socket_active_state(Unit *u) {
index eb2af229b579231968287ee286dc078cb06e1c4f..03d7d8de7f4ee6529ec19e923eea6443029b2af2 100644 (file)
@@ -322,7 +322,7 @@ struct UnitVTable {
         int (*deserialize_item)(Unit *u, const char *key, const char *data, FDSet *fds);
 
         /* Try to match up fds with what we need for this unit */
-        int (*distribute_fds)(Unit *u, FDSet *fds);
+        void (*distribute_fds)(Unit *u, FDSet *fds);
 
         /* Boils down the more complex internal state of this unit to
          * a simpler one that the engine can understand */