Fix process-contact bug with TCP connections
This fixes a regression from Emacs 25.3 (Bug#34134). * src/process.c (server_accept_connection): Set host correctly, fixing a bug introduced in 2017-09-16T21:29:18Z!eggert@cs.ucla.edu when working around a GCC bug.
This commit is contained in:
parent
b94d767527
commit
9c8412a0b8
1 changed files with 10 additions and 4 deletions
|
@ -4724,19 +4724,24 @@ server_accept_connection (Lisp_Object server, int channel)
|
||||||
service = Qnil;
|
service = Qnil;
|
||||||
Lisp_Object args[11];
|
Lisp_Object args[11];
|
||||||
int nargs = 0;
|
int nargs = 0;
|
||||||
AUTO_STRING (procname_format_in, "%s <%d.%d.%d.%d:%d>");
|
#define HOST_FORMAT_IN "%d.%d.%d.%d"
|
||||||
AUTO_STRING (procname_format_in6, "%s <[%x:%x:%x:%x:%x:%x:%x:%x]:%d>");
|
#define HOST_FORMAT_IN6 "%x:%x:%x:%x:%x:%x:%x:%x"
|
||||||
|
AUTO_STRING (host_format_in, HOST_FORMAT_IN);
|
||||||
|
AUTO_STRING (host_format_in6, HOST_FORMAT_IN6);
|
||||||
|
AUTO_STRING (procname_format_in, "%s <"HOST_FORMAT_IN":%d>");
|
||||||
|
AUTO_STRING (procname_format_in6, "%s <["HOST_FORMAT_IN6"]:%d>");
|
||||||
AUTO_STRING (procname_format_default, "%s <%d>");
|
AUTO_STRING (procname_format_default, "%s <%d>");
|
||||||
switch (saddr.sa.sa_family)
|
switch (saddr.sa.sa_family)
|
||||||
{
|
{
|
||||||
case AF_INET:
|
case AF_INET:
|
||||||
{
|
{
|
||||||
args[nargs++] = procname_format_in;
|
args[nargs++] = procname_format_in;
|
||||||
nargs++;
|
args[nargs++] = host_format_in;
|
||||||
unsigned char *ip = (unsigned char *)&saddr.in.sin_addr.s_addr;
|
unsigned char *ip = (unsigned char *)&saddr.in.sin_addr.s_addr;
|
||||||
service = make_number (ntohs (saddr.in.sin_port));
|
service = make_number (ntohs (saddr.in.sin_port));
|
||||||
for (int i = 0; i < 4; i++)
|
for (int i = 0; i < 4; i++)
|
||||||
args[nargs++] = make_number (ip[i]);
|
args[nargs++] = make_number (ip[i]);
|
||||||
|
host = Fformat (5, args + 1);
|
||||||
args[nargs++] = service;
|
args[nargs++] = service;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -4745,11 +4750,12 @@ server_accept_connection (Lisp_Object server, int channel)
|
||||||
case AF_INET6:
|
case AF_INET6:
|
||||||
{
|
{
|
||||||
args[nargs++] = procname_format_in6;
|
args[nargs++] = procname_format_in6;
|
||||||
nargs++;
|
args[nargs++] = host_format_in6;
|
||||||
DECLARE_POINTER_ALIAS (ip6, uint16_t, &saddr.in6.sin6_addr);
|
DECLARE_POINTER_ALIAS (ip6, uint16_t, &saddr.in6.sin6_addr);
|
||||||
service = make_number (ntohs (saddr.in.sin_port));
|
service = make_number (ntohs (saddr.in.sin_port));
|
||||||
for (int i = 0; i < 8; i++)
|
for (int i = 0; i < 8; i++)
|
||||||
args[nargs++] = make_number (ip6[i]);
|
args[nargs++] = make_number (ip6[i]);
|
||||||
|
host = Fformat (9, args + 1);
|
||||||
args[nargs++] = service;
|
args[nargs++] = service;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue