SIGN IN SIGN UP

libvncclient: fix the fork()ing listening for incoming connections

listenForIncomingConnections() uses a socket declared as a local variable, whereas accepting
used an uninitialized client member variable. Note that the use of a
local variable is necessary because the pointer to the client is invalid
in the child process.

The problem was highlighted with x11vnc when running a VNC repeater
(x11vnc -reflect listen:5500) waiting for an incoming connection from a
VNC server (x11vnc -connect IP.ADDRESS.OF.REPEATER). When an incoming
connection request was submitted, the repeater did not accept it and
returned an error.

The regression was introduced by 75bfb1f5d396b2908a9615cd02bebfc952baa045

Co-authored-by: Vincent Forest <vincent.forest@meso-star.com>
V
vaplv committed
4c15a85d448c33f08ddd3d713672c70ea507f5ee
Parent: e64fa92
Committed by GitHub <noreply@github.com> on 7/14/2025, 6:35:05 PM