aboutsummaryrefslogtreecommitdiffstats
path: root/lib-src
diff options
context:
space:
mode:
authorStefan Kangas2022-09-09 11:19:21 +0200
committerStefan Kangas2022-09-09 11:20:33 +0200
commitc6d8db8d91649d4e30bb26c662ac867136005c0c (patch)
tree583431c29e88648fdc1f3e140319ac9668c445d7 /lib-src
parenta0886b321c4792ac52d69900a999840c7ee1d90a (diff)
downloademacs-c6d8db8d91649d4e30bb26c662ac867136005c0c.tar.gz
emacs-c6d8db8d91649d4e30bb26c662ac867136005c0c.zip
Display error in emacsclient if setsockopt failed
* lib-src/emacsclient.c (set_tcp_socket, set_socket_timeout): Display an error message if setsockopt failed.
Diffstat (limited to 'lib-src')
-rw-r--r--lib-src/emacsclient.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/lib-src/emacsclient.c b/lib-src/emacsclient.c
index 49d90a989fc..88800b9b2e9 100644
--- a/lib-src/emacsclient.c
+++ b/lib-src/emacsclient.c
@@ -1078,7 +1078,9 @@ set_tcp_socket (const char *local_server_file)
1078 1078
1079 /* The cast to 'const char *' is to avoid a compiler warning when 1079 /* The cast to 'const char *' is to avoid a compiler warning when
1080 compiling for MS-Windows sockets. */ 1080 compiling for MS-Windows sockets. */
1081 setsockopt (s, SOL_SOCKET, SO_LINGER, (const char *) &l_arg, sizeof l_arg); 1081 int ret = setsockopt (s, SOL_SOCKET, SO_LINGER, (const char *) &l_arg, sizeof l_arg);
1082 if (ret < 0)
1083 sock_err_message ("setsockopt");
1082 1084
1083 /* Send the authentication. */ 1085 /* Send the authentication. */
1084 auth_string[AUTH_KEY_LENGTH] = '\0'; 1086 auth_string[AUTH_KEY_LENGTH] = '\0';
@@ -1892,11 +1894,13 @@ start_daemon_and_retry_set_socket (void)
1892static void 1894static void
1893set_socket_timeout (HSOCKET socket, int seconds) 1895set_socket_timeout (HSOCKET socket, int seconds)
1894{ 1896{
1897 int ret;
1898
1895#ifndef WINDOWSNT 1899#ifndef WINDOWSNT
1896 struct timeval timeout; 1900 struct timeval timeout;
1897 timeout.tv_sec = seconds; 1901 timeout.tv_sec = seconds;
1898 timeout.tv_usec = 0; 1902 timeout.tv_usec = 0;
1899 setsockopt (socket, SOL_SOCKET, SO_RCVTIMEO, &timeout, sizeof timeout); 1903 ret = setsockopt (socket, SOL_SOCKET, SO_RCVTIMEO, &timeout, sizeof timeout);
1900#else 1904#else
1901 DWORD timeout; 1905 DWORD timeout;
1902 1906
@@ -1904,8 +1908,11 @@ set_socket_timeout (HSOCKET socket, int seconds)
1904 timeout = INT_MAX; 1908 timeout = INT_MAX;
1905 else 1909 else
1906 timeout = seconds * 1000; 1910 timeout = seconds * 1000;
1907 setsockopt (socket, SOL_SOCKET, SO_RCVTIMEO, (char *) &timeout, sizeof timeout); 1911 ret = setsockopt (socket, SOL_SOCKET, SO_RCVTIMEO, (char *) &timeout, sizeof timeout);
1908#endif 1912#endif
1913
1914 if (ret < 0)
1915 sock_err_message ("setsockopt");
1909} 1916}
1910 1917
1911static bool 1918static bool