From: Pierre Ossman Date: Mon, 11 Jul 2016 07:44:14 +0000 (+0200) Subject: Fix display/port switch at display 100 X-Git-Tag: v1.7.90~99 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=7caaea10402e3d00d2e1c2e6d233b64b0a71273a;p=tigervnc.git Fix display/port switch at display 100 168b92c broke the handling that assumes display 100 and above are actually a port number. --- 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; } }