From 7caaea10402e3d00d2e1c2e6d233b64b0a71273a Mon Sep 17 00:00:00 2001 From: Pierre Ossman Date: Mon, 11 Jul 2016 09:44:14 +0200 Subject: [PATCH] Fix display/port switch at display 100 168b92c broke the handling that assumes display 100 and above are actually a port number. --- common/rfb/Hostname.h | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/common/rfb/Hostname.h b/common/rfb/Hostname.h index 02c51a61..bd68dc02 100644 --- a/common/rfb/Hostname.h +++ b/common/rfb/Hostname.h @@ -84,17 +84,14 @@ namespace rfb { throw rdr::Exception("invalid port specified"); if (portStart[1] != ':') - portStart += 1; - else { - portStart += 2; - basePort = 0; - } - - *port = strtol(portStart, &end, 10); + *port = strtol(portStart + 1, &end, 10); + else + *port = strtol(portStart + 2, &end, 10); if (*end != '\0') throw rdr::Exception("invalid port specified"); - *port += basePort; + if ((portStart[1] != ':') && (*port < 100)) + *port += basePort; } } -- 2.39.5