From ac7659bf6a5f84f473424c6976e4ccd6c2e72979 Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Thu, 8 Jun 2023 16:46:12 +0000 Subject: [PATCH] daemon: Don't crash when a port could not be loaded Signed-off-by: Michael Tremer --- src/networkd/ports.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/networkd/ports.c b/src/networkd/ports.c index f0a3ebbc..65545e81 100644 --- a/src/networkd/ports.c +++ b/src/networkd/ports.c @@ -152,8 +152,20 @@ static int __nw_ports_enumerate(const char* path, const struct stat* s, void* da // Create a new port r = nw_port_create_from_config(&port, ports->daemon, name, path); - if (r) - goto ERROR; + switch (r) { + // All okay + case 0: + break; + + // Invalid configuration + case 1: + ERROR("Could not open port %s\n", name); + r = 0; + goto ERROR; + + default: + goto ERROR; + } // Add the port to the list r = nw_ports_add_port(ports, port); -- 2.47.2