mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-06 14:30:50 -08:00
Display error in emacsclient if setsockopt failed
* lib-src/emacsclient.c (set_tcp_socket, set_socket_timeout): Display an error message if setsockopt failed.
This commit is contained in:
parent
a0886b321c
commit
c6d8db8d91
1 changed files with 10 additions and 3 deletions
|
|
@ -1078,7 +1078,9 @@ set_tcp_socket (const char *local_server_file)
|
||||||
|
|
||||||
/* The cast to 'const char *' is to avoid a compiler warning when
|
/* The cast to 'const char *' is to avoid a compiler warning when
|
||||||
compiling for MS-Windows sockets. */
|
compiling for MS-Windows sockets. */
|
||||||
setsockopt (s, SOL_SOCKET, SO_LINGER, (const char *) &l_arg, sizeof l_arg);
|
int ret = setsockopt (s, SOL_SOCKET, SO_LINGER, (const char *) &l_arg, sizeof l_arg);
|
||||||
|
if (ret < 0)
|
||||||
|
sock_err_message ("setsockopt");
|
||||||
|
|
||||||
/* Send the authentication. */
|
/* Send the authentication. */
|
||||||
auth_string[AUTH_KEY_LENGTH] = '\0';
|
auth_string[AUTH_KEY_LENGTH] = '\0';
|
||||||
|
|
@ -1892,11 +1894,13 @@ start_daemon_and_retry_set_socket (void)
|
||||||
static void
|
static void
|
||||||
set_socket_timeout (HSOCKET socket, int seconds)
|
set_socket_timeout (HSOCKET socket, int seconds)
|
||||||
{
|
{
|
||||||
|
int ret;
|
||||||
|
|
||||||
#ifndef WINDOWSNT
|
#ifndef WINDOWSNT
|
||||||
struct timeval timeout;
|
struct timeval timeout;
|
||||||
timeout.tv_sec = seconds;
|
timeout.tv_sec = seconds;
|
||||||
timeout.tv_usec = 0;
|
timeout.tv_usec = 0;
|
||||||
setsockopt (socket, SOL_SOCKET, SO_RCVTIMEO, &timeout, sizeof timeout);
|
ret = setsockopt (socket, SOL_SOCKET, SO_RCVTIMEO, &timeout, sizeof timeout);
|
||||||
#else
|
#else
|
||||||
DWORD timeout;
|
DWORD timeout;
|
||||||
|
|
||||||
|
|
@ -1904,8 +1908,11 @@ set_socket_timeout (HSOCKET socket, int seconds)
|
||||||
timeout = INT_MAX;
|
timeout = INT_MAX;
|
||||||
else
|
else
|
||||||
timeout = seconds * 1000;
|
timeout = seconds * 1000;
|
||||||
setsockopt (socket, SOL_SOCKET, SO_RCVTIMEO, (char *) &timeout, sizeof timeout);
|
ret = setsockopt (socket, SOL_SOCKET, SO_RCVTIMEO, (char *) &timeout, sizeof timeout);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
if (ret < 0)
|
||||||
|
sock_err_message ("setsockopt");
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue