Skip to content

libvncclient: close the IPv4 socket when mode setup fails - #771

Open
omrzk wants to merge 1 commit into
LibVNC:masterfrom
omrzk:fix/ipv4-nonblocking-failure
Open

omrzk wants to merge 1 commit into
LibVNC:masterfrom
omrzk:fix/ipv4-nonblocking-failure

Conversation

@omrzk

@omrzk omrzk commented Nov 18, 2026

Copy link
Copy Markdown

Fixes #753.

When the IPv4 connection helper cannot set its new socket nonblocking, it returns FALSE (descriptor 0) and leaves the socket open. Close the owned socket and return RFB_INVALID_SOCKET, matching the other connection failure paths. The legacy wrapper can then avoid treating stdin as a connected socket.

Add a Linux shared-library regression that injects the mode-change failure and checks the result, descriptor cleanup and stdin flags. Repeated real loopback connections preserve successful delivery and the blocking/nonblocking contracts of both public helpers.

Validation: the exact regression produces 41 assertion failures on master and passes here. The configured Linux shared build, installation and all five CTests pass; the new test also compiles with GNU90 and -Wall -Wextra -Werror. Independent tests retaining the real mode-change helper reproduce four failures on master and pass here with injected F_GETFL/F_SETFL errors. Optional graphics/compression dependencies were unavailable; no native Windows or full RFB handshake test is claimed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

wrong return value in ConnectClientToTcpAddr()

1 participant