[geany/geany] 690df7: Windows: Use SO_EXCLUSIVEADDRUSE flag for IPC socket

Enrico Tröger git-noreply at xxxxx
Sun Apr 7 09:33:05 UTC 2019


Branch:      refs/heads/master
Author:      Enrico Tröger <enrico.troeger at uvena.de>
Committer:   Enrico Tröger <enrico.troeger at uvena.de>
Date:        Sun, 07 Apr 2019 09:33:05 UTC
Commit:      690df746bfb1ce5b28484b953918c9e9852385c1
             https://github.com/geany/geany/commit/690df746bfb1ce5b28484b953918c9e9852385c1

Log Message:
-----------
Windows: Use SO_EXCLUSIVEADDRUSE flag for IPC socket

SO_REUSEADDR on Windows allows to bind to an already used port
without an error. This way we never notice if the port is already used.
So use the Windows special flag SO_EXCLUSIVEADDRUSE to ensure we receive
an error if the port is already used.

Part of #641.


Modified Paths:
--------------
    src/socket.c

Modified: src/socket.c
2 lines changed, 1 insertions(+), 1 deletions(-)
===================================================================
@@ -524,7 +524,7 @@ static gint socket_fd_open_inet(gushort port)
 	}
 
 	val = 1;
-	if (setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, &val, sizeof(val)) < 0)
+	if (setsockopt(sock, SOL_SOCKET, SO_EXCLUSIVEADDRUSE, &val, sizeof(val)) < 0)
 	{
 		log_error("Failed to set IPC socket exclusive option", -1);
 		socket_fd_close(sock);



--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).


More information about the Commits mailing list