From: Michael Tremer Date: Thu, 8 Jun 2023 16:46:12 +0000 (+0000) Subject: daemon: Don't crash when a port could not be loaded X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ac7659bf6a5f84f473424c6976e4ccd6c2e72979;p=network.git daemon: Don't crash when a port could not be loaded Signed-off-by: Michael Tremer --- 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);