fix for symlinks with colon (fixes #1374)

This commit is contained in:
John
2024-11-11 20:36:56 +01:00
parent bcea04b757
commit 8d2986c58f
+3 -1
View File
@@ -70,7 +70,8 @@ ProtocolHandler* ProtocolHandler::create(const ebus_protocol_config_t config,
}
}
Transport* transport;
if (strchr(name, '/') == nullptr || strchr(name, ':') != nullptr) {
// symlink device name may contain colon, so only check for absence of slash only
if (strchr(name, '/') == nullptr) {
char* in = strdup(name);
bool udp = false;
char* addrpos = in;
@@ -97,6 +98,7 @@ ProtocolHandler* ProtocolHandler::create(const ebus_protocol_config_t config,
transport = new NetworkTransport(name, config.extraLatency, hostOrIp, port, udp);
} else {
// support ens:/dev/<device>, enh:/dev/<device>, and /dev/<device>
// as well as symlinks like /dev/serial/by-id/...Espressif_00:01:02:03...
transport = new SerialTransport(name, config.extraLatency, !config.noDeviceCheck, speed);
}
Device* device;