diff options
author | Carlos Santos <casantos@redhat.com> | 2025-06-11 21:26:08 -0300 |
---|---|---|
committer | Carlos Santos <casantos@redhat.com> | 2025-06-13 17:03:17 -0300 |
commit | 24af40e7c0fa01a818a5c835ec8848ad6744e661 (patch) | |
tree | 10bbf360e42a8eeef1be94d8fd49de6b1ae8d091 | |
parent | 419be7dcb55e29a3be22a7cb2793b8434107361a (diff) | |
download | tigervnc-24af40e7c0fa01a818a5c835ec8848ad6744e661.tar.gz tigervnc-24af40e7c0fa01a818a5c835ec8848ad6744e661.zip |
xvnc.c: faster handling of the display argument in ddxProcessArgument()
Return zero if the current argument starts with ":". It's useless to
check if it matches any of the other Xvnc arguments.
Also use the global variable explicit_display, set by the X server code,
instead of a private flag.
Signed-off-by: Carlos Santos <casantos@redhat.com>
-rw-r--r-- | unix/xserver/hw/vnc/xvnc.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/unix/xserver/hw/vnc/xvnc.c b/unix/xserver/hw/vnc/xvnc.c index 4c50c670..8aaed379 100644 --- a/unix/xserver/hw/vnc/xvnc.c +++ b/unix/xserver/hw/vnc/xvnc.c @@ -110,7 +110,6 @@ static VncScreenInfo vncScreenInfo = { static Bool vncPixmapDepths[33]; static Bool Render = TRUE; -static Bool displaySpecified = FALSE; static char displayNumStr[16]; static int vncVerbose = 0; @@ -278,7 +277,7 @@ ddxProcessArgument(int argc, char *argv[], int i) } if (argv[i][0] == ':') - displaySpecified = TRUE; + return 0; #if XORG_OLDER_THAN(1, 21, 1) #define CHECK_FOR_REQUIRED_ARGUMENTS(num) \ @@ -386,7 +385,7 @@ ddxProcessArgument(int argc, char *argv[], int i) dup2(nullfd, 2); close(nullfd); - if (!displaySpecified) { + if (!explicit_display) { int port = vncGetSocketPort(vncInetdSock); int displayNum = port - 5900; @@ -400,9 +399,9 @@ ddxProcessArgument(int argc, char *argv[], int i) FatalError ("Xvnc error: No free display number for -inetd\n"); } - - display = displayNumStr; sprintf(displayNumStr, "%d", displayNum); + display = displayNumStr; + explicit_display = TRUE; } return 1; |