summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--admin/CPP-DEFINES2
-rw-r--r--configure.ac16
-rw-r--r--doc/lispref/processes.texi8
-rw-r--r--etc/NEWS9
-rw-r--r--lib-src/pop.c39
-rw-r--r--lisp/mpc.el5
-rw-r--r--lisp/net/network-stream.el4
-rw-r--r--src/process.c68
8 files changed, 17 insertions, 134 deletions
diff --git a/admin/CPP-DEFINES b/admin/CPP-DEFINES
index 9064053934b..d9df152bff5 100644
--- a/admin/CPP-DEFINES
+++ b/admin/CPP-DEFINES
@@ -147,7 +147,6 @@ HAVE_FUTIMES
HAVE_FUTIMESAT
HAVE_GAI_STRERROR
HAVE_GCONF
-HAVE_GETADDRINFO
HAVE_GETDELIM
HAVE_GETGRENT
HAVE_GETHOSTNAME
@@ -184,7 +183,6 @@ HAVE_GTK_WIDGET_GET_WINDOW
HAVE_GTK_WIDGET_SET_HAS_WINDOW
HAVE_GTK_WINDOW_SET_HAS_RESIZE_GRIP
HAVE_G_TYPE_INIT
-HAVE_H_ERRNO
HAVE_IFADDRS_H
HAVE_IMAGEMAGICK
HAVE_INET_SOCKETS
diff --git a/configure.ac b/configure.ac
index 61287d74cab..940a1e23b3c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3701,20 +3701,6 @@ fi
AC_SUBST(LIBXML2_LIBS)
AC_SUBST(LIBXML2_CFLAGS)
-# If netdb.h doesn't declare h_errno, we must declare it by hand.
-# On MinGW, that is provided by nt/inc/sys/socket.h and w32.c.
-if test "${opsys}" = "mingw32"; then
- emacs_cv_netdb_declares_h_errno=yes
-fi
-AC_CACHE_CHECK(whether netdb declares h_errno,
- emacs_cv_netdb_declares_h_errno,
-[AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <netdb.h>]],
- [[return h_errno;]])],
- emacs_cv_netdb_declares_h_errno=yes, emacs_cv_netdb_declares_h_errno=no)])
-if test $emacs_cv_netdb_declares_h_errno = yes; then
- AC_DEFINE(HAVE_H_ERRNO, 1, [Define to 1 if netdb.h declares h_errno.])
-fi
-
# Check for mail-locking functions in a "mail" library. Probably this should
# have the same check as for liblockfile below.
AC_CHECK_LIB(mail, maillock, have_mail=yes, have_mail=no)
@@ -3803,7 +3789,7 @@ AC_CHECK_FUNCS(accept4 fchdir gethostname \
getrusage get_current_dir_name \
lrand48 random rint \
select getpagesize setlocale newlocale \
-getrlimit setrlimit shutdown getaddrinfo \
+getrlimit setrlimit shutdown \
pthread_sigmask strsignal setitimer \
sendto recvfrom getsockname getpeername getifaddrs freeifaddrs \
gai_strerror sync \
diff --git a/doc/lispref/processes.texi b/doc/lispref/processes.texi
index 79cebaa79fa..8d3df55cba9 100644
--- a/doc/lispref/processes.texi
+++ b/doc/lispref/processes.texi
@@ -2128,7 +2128,8 @@ associated with any buffer.
The arguments @var{host} and @var{service} specify where to connect to;
@var{host} is the host name (a string), and @var{service} is the name of
-a defined network service (a string) or a port number (an integer).
+a defined network service (a string) or a port number (an integer like
+@code{80} or an integer string like @code{"80"}).
The remaining arguments @var{parameters} are keyword/argument pairs
that are mainly relevant to encrypted connections:
@@ -2352,8 +2353,9 @@ connecting to that address will be accepted.
@item :service @var{service}
@var{service} specifies a port number to connect to; or, for a server,
-the port number to listen on. It should be a service name that
-translates to a port number, or an integer specifying the port number
+the port number to listen on. It should be a service name like
+@samp{"http"} that translates to a port number, or an integer like @samp{80}
+or an integer string like @samp{"80"} that specifies the port number
directly. For a server, it can also be @code{t}, which means to let
the system select an unused port number.
diff --git a/etc/NEWS b/etc/NEWS
index 4328761cf36..b651b9eb880 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -74,11 +74,10 @@ to deal with asynchronous sockets is to avoid interacting with them
until they have changed status to "run". This is most easily done
from a process sentinel.
-** `make-network-stream' has always allowed :service to be specified
-as a "number string" (i.e., :service "993") when using gethostbyname,
-but has required using a real number (i.e., :service 993) on systems
-without gethostbyname. This difference has now been eliminated, and
-you can use "number strings" on all systems.
+** ‘make-network-process’ and ‘open-network-stream’ sometimes allowed
+:service to be an integer string (e.g., :service "993") and sometimes
+required an integer (e.g., :service 993). This difference has been
+eliminated, and integer strings work everywhere.
** It is possible to disable attempted recovery on fatal signals
diff --git a/lib-src/pop.c b/lib-src/pop.c
index 21d721546b7..983993461b5 100644
--- a/lib-src/pop.c
+++ b/lib-src/pop.c
@@ -102,12 +102,6 @@ extern char *krb_realmofhost (/* char * */);
#endif /* ! KERBEROS5 */
#endif /* KERBEROS */
-#ifndef WINDOWSNT
-#ifndef HAVE_H_ERRNO
-extern int h_errno;
-#endif
-#endif
-
static int socket_connection (char *, int);
static int pop_getline (popserver, char **);
static int sendline (popserver, const char *);
@@ -972,13 +966,9 @@ static int have_winsock = 0;
static int
socket_connection (char *host, int flags)
{
-#ifdef HAVE_GETADDRINFO
struct addrinfo *res, *it;
struct addrinfo hints;
int ret;
-#else /* !HAVE_GETADDRINFO */
- struct hostent *hostent;
-#endif
struct servent *servent;
struct sockaddr_in addr;
char found_port = 0;
@@ -1065,7 +1055,6 @@ socket_connection (char *host, int flags)
}
-#ifdef HAVE_GETADDRINFO
memset (&hints, 0, sizeof (hints));
hints.ai_socktype = SOCK_STREAM;
hints.ai_flags = AI_CANONNAME;
@@ -1097,34 +1086,6 @@ socket_connection (char *host, int flags)
}
freeaddrinfo (res);
-#else /* !HAVE_GETADDRINFO */
- do
- {
- hostent = gethostbyname (host);
- try_count++;
- if ((! hostent) && ((h_errno != TRY_AGAIN) || (try_count == 5)))
- {
- strcpy (pop_error, "Could not determine POP server's address");
- return (-1);
- }
- } while (! hostent);
-
- while (*hostent->h_addr_list)
- {
- memcpy (&addr.sin_addr, *hostent->h_addr_list, hostent->h_length);
- if (! connect (sock, (struct sockaddr *) &addr, sizeof (addr)))
- break;
- hostent->h_addr_list++;
- }
- connect_ok = *hostent->h_addr_list != NULL;
- if (! connect_ok)
- {
- realhost = alloca (strlen (hostent->h_name) + 1);
- strcpy (realhost, hostent->h_name);
- }
-
-#endif /* !HAVE_GETADDRINFO */
-
#define CONNECT_ERROR "Could not connect to POP server: "
if (! connect_ok)
diff --git a/lisp/mpc.el b/lisp/mpc.el
index 20e4bc85d85..aa7fee6adb6 100644
--- a/lisp/mpc.el
+++ b/lisp/mpc.el
@@ -265,10 +265,7 @@ defaults to 6600 and HOST defaults to localhost."
(let ((v (match-string 3 host)))
(setq host (match-string 2 host))
(when (and (stringp v) (not (string= "" v)))
- (setq port
- (if (string-match "[^[:digit:]]" v)
- (string-to-number v)
- v)))))
+ (setq port v))))
(when (file-name-absolute-p host)
;; Expand file name because `file-name-absolute-p'
;; considers paths beginning with "~" as absolute
diff --git a/lisp/net/network-stream.el b/lisp/net/network-stream.el
index f919efb2197..5ddaef58a89 100644
--- a/lisp/net/network-stream.el
+++ b/lisp/net/network-stream.el
@@ -65,8 +65,8 @@ BUFFER is a buffer or buffer name to associate with the process.
Process output goes at end of that buffer. BUFFER may be nil,
meaning that the process is not associated with any buffer.
HOST is the name or IP address of the host to connect to.
-SERVICE is the name of the service desired, or an integer specifying
- a port number to connect to.
+SERVICE is the name of the service desired, or an integer or
+ integer string specifying a port number to connect to.
The remaining PARAMETERS should be a sequence of keywords and
values:
diff --git a/src/process.c b/src/process.c
index 69f5e1ddca6..359cd2195aa 100644
--- a/src/process.c
+++ b/src/process.c
@@ -3429,21 +3429,6 @@ connect_network_socket (Lisp_Object proc, Lisp_Object ip_addresses)
}
-#ifndef HAVE_GETADDRINFO
-static Lisp_Object
-conv_numerical_to_lisp (unsigned char *number, int length, int port)
-{
- Lisp_Object address = Fmake_vector (make_number (length + 1), Qnil);
- struct Lisp_Vector *p = XVECTOR (address);
-
- p->contents[length] = make_number (port);
- for (int i = 0; i < length; i++)
- p->contents[i] = make_number (number[i]);
-
- return address;
-}
-#endif
-
/* Create a network stream/datagram client/server process. Treated
exactly like a normal process when reading and writing. Primary
differences are in status display and process deletion. A network
@@ -3479,9 +3464,8 @@ host, and only clients connecting to that address will be accepted.
:service SERVICE -- SERVICE is name of the service desired, or an
integer specifying a port number to connect to. If SERVICE is t,
-a random port number is selected for the server. (If Emacs was
-compiled with getaddrinfo, a port number can also be specified as a
-string, e.g. "80", as well as an integer. This is not portable.)
+a random port number is selected for the server. A port number can
+be specified as an integer string, e.g., "80", as well as an integer.
:type TYPE -- TYPE is the type of connection. The default (nil) is a
stream type connection, `datagram' creates a datagram type connection,
@@ -3614,11 +3598,9 @@ usage: (make-network-process &rest ARGS) */)
Lisp_Object proc;
Lisp_Object contact;
struct Lisp_Process *p;
-#if defined HAVE_GETADDRINFO || defined HAVE_GETADDRINFO_A
const char *portstring;
ptrdiff_t portstringlen ATTRIBUTE_UNUSED;
char portbuf[INT_BUFSIZE_BOUND (EMACS_INT)];
-#endif
#ifdef HAVE_LOCAL_SOCKETS
struct sockaddr_un address_un;
#endif
@@ -3689,7 +3671,7 @@ usage: (make-network-process &rest ARGS) */)
tem = Fplist_get (contact, QCfamily);
if (NILP (tem))
{
-#if defined (HAVE_GETADDRINFO) && defined (AF_INET6)
+#ifdef AF_INET6
family = AF_UNSPEC;
#else
family = AF_INET;
@@ -3761,7 +3743,6 @@ usage: (make-network-process &rest ARGS) */)
}
#endif
-#if defined HAVE_GETADDRINFO || defined HAVE_GETADDRINFO_A
if (!NILP (host))
{
/* SERVICE can either be a string or int.
@@ -3783,7 +3764,6 @@ usage: (make-network-process &rest ARGS) */)
portstringlen = SBYTES (service);
}
}
-#endif
#ifdef HAVE_GETADDRINFO_A
if (!NILP (host) && !NILP (Fplist_get (contact, QCnowait)))
@@ -3815,7 +3795,6 @@ usage: (make-network-process &rest ARGS) */)
}
#endif /* HAVE_GETADDRINFO_A */
-#ifdef HAVE_GETADDRINFO
/* If we have a host, use getaddrinfo to resolve both host and service.
Otherwise, use getservbyname to lookup the service. */
@@ -3855,10 +3834,8 @@ usage: (make-network-process &rest ARGS) */)
goto open_socket;
}
-#endif /* HAVE_GETADDRINFO */
- /* We end up here if getaddrinfo is not defined, or in case no hostname
- has been specified (e.g. for a local server process). */
+ /* No hostname has been specified (e.g., a local server process). */
if (EQ (service, Qt))
port = 0;
@@ -3894,43 +3871,6 @@ usage: (make-network-process &rest ARGS) */)
xsignal1 (Qerror, CALLN (Fformat, unknown_service, service));
}
-#ifndef HAVE_GETADDRINFO
- if (!NILP (host))
- {
- struct hostent *host_info_ptr;
- unsigned char *addr;
- int addrlen;
-
- /* gethostbyname may fail with TRY_AGAIN, but we don't honor that,
- as it may `hang' Emacs for a very long time. */
- immediate_quit = 1;
- QUIT;
-
- host_info_ptr = gethostbyname ((const char *) SDATA (host));
- immediate_quit = 0;
-
- if (host_info_ptr)
- {
- addr = (unsigned char *) host_info_ptr->h_addr;
- addrlen = host_info_ptr->h_length;
- }
- else
- /* Attempt to interpret host as numeric inet address. This
- only works for IPv4 addresses. */
- {
- unsigned long numeric_addr = inet_addr (SSDATA (host));
-
- if (numeric_addr == -1)
- error ("Unknown host \"%s\"", SDATA (host));
-
- addr = (unsigned char *) &numeric_addr;
- addrlen = 4;
- }
-
- ip_addresses = list1 (conv_numerical_to_lisp (addr, addrlen, port));
- }
-#endif /* not HAVE_GETADDRINFO */
-
open_socket:
if (!NILP (buffer))