diff options
| author | Paul Eggert | 2016-03-07 18:54:25 -0800 |
|---|---|---|
| committer | Paul Eggert | 2016-03-07 18:55:20 -0800 |
| commit | 59c7a5d71145d88933a535e222bdf30105e7d382 (patch) | |
| tree | 04724485be6c619e6257873f7d05c2ae51bcbb64 | |
| parent | 6bc8689c042830ae8c13e34af993e8f923e47c9d (diff) | |
| download | emacs-59c7a5d71145d88933a535e222bdf30105e7d382.tar.gz emacs-59c7a5d71145d88933a535e222bdf30105e7d382.zip | |
Assume getaddrinfo in C code
* admin/CPP-DEFINES, configure.ac: Remove HAVE_GETADDRINFO, HAVE_H_ERRNO.
All uses removed.
* doc/lispref/processes.texi (Network, Network Processes), etc/NEWS:
Say that port numbers can be integer strings.
* lib-src/pop.c (h_errno) [!WINDOWSNT && !HAVE_H_ERRNO]: Remove decl.
(socket_connection): Assume HAVE_GETADDRINFO.
* lisp/mpc.el (mpc--proc-connect):
* lisp/net/network-stream.el (open-network-stream):
It’s now OK to use integer strings as port numbers.
* src/process.c (conv_numerical_to_lisp) [!HAVE_GETADDRINFO]: Remove.
(Fmake_network_process): Assume HAVE_GETADDRINFO.
| -rw-r--r-- | admin/CPP-DEFINES | 2 | ||||
| -rw-r--r-- | configure.ac | 16 | ||||
| -rw-r--r-- | doc/lispref/processes.texi | 8 | ||||
| -rw-r--r-- | etc/NEWS | 9 | ||||
| -rw-r--r-- | lib-src/pop.c | 39 | ||||
| -rw-r--r-- | lisp/mpc.el | 5 | ||||
| -rw-r--r-- | lisp/net/network-stream.el | 4 | ||||
| -rw-r--r-- | src/process.c | 68 |
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 | |||
| 147 | HAVE_FUTIMESAT | 147 | HAVE_FUTIMESAT |
| 148 | HAVE_GAI_STRERROR | 148 | HAVE_GAI_STRERROR |
| 149 | HAVE_GCONF | 149 | HAVE_GCONF |
| 150 | HAVE_GETADDRINFO | ||
| 151 | HAVE_GETDELIM | 150 | HAVE_GETDELIM |
| 152 | HAVE_GETGRENT | 151 | HAVE_GETGRENT |
| 153 | HAVE_GETHOSTNAME | 152 | HAVE_GETHOSTNAME |
| @@ -184,7 +183,6 @@ HAVE_GTK_WIDGET_GET_WINDOW | |||
| 184 | HAVE_GTK_WIDGET_SET_HAS_WINDOW | 183 | HAVE_GTK_WIDGET_SET_HAS_WINDOW |
| 185 | HAVE_GTK_WINDOW_SET_HAS_RESIZE_GRIP | 184 | HAVE_GTK_WINDOW_SET_HAS_RESIZE_GRIP |
| 186 | HAVE_G_TYPE_INIT | 185 | HAVE_G_TYPE_INIT |
| 187 | HAVE_H_ERRNO | ||
| 188 | HAVE_IFADDRS_H | 186 | HAVE_IFADDRS_H |
| 189 | HAVE_IMAGEMAGICK | 187 | HAVE_IMAGEMAGICK |
| 190 | HAVE_INET_SOCKETS | 188 | 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 | |||
| 3701 | AC_SUBST(LIBXML2_LIBS) | 3701 | AC_SUBST(LIBXML2_LIBS) |
| 3702 | AC_SUBST(LIBXML2_CFLAGS) | 3702 | AC_SUBST(LIBXML2_CFLAGS) |
| 3703 | 3703 | ||
| 3704 | # If netdb.h doesn't declare h_errno, we must declare it by hand. | ||
| 3705 | # On MinGW, that is provided by nt/inc/sys/socket.h and w32.c. | ||
| 3706 | if test "${opsys}" = "mingw32"; then | ||
| 3707 | emacs_cv_netdb_declares_h_errno=yes | ||
| 3708 | fi | ||
| 3709 | AC_CACHE_CHECK(whether netdb declares h_errno, | ||
| 3710 | emacs_cv_netdb_declares_h_errno, | ||
| 3711 | [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <netdb.h>]], | ||
| 3712 | [[return h_errno;]])], | ||
| 3713 | emacs_cv_netdb_declares_h_errno=yes, emacs_cv_netdb_declares_h_errno=no)]) | ||
| 3714 | if test $emacs_cv_netdb_declares_h_errno = yes; then | ||
| 3715 | AC_DEFINE(HAVE_H_ERRNO, 1, [Define to 1 if netdb.h declares h_errno.]) | ||
| 3716 | fi | ||
| 3717 | |||
| 3718 | # Check for mail-locking functions in a "mail" library. Probably this should | 3704 | # Check for mail-locking functions in a "mail" library. Probably this should |
| 3719 | # have the same check as for liblockfile below. | 3705 | # have the same check as for liblockfile below. |
| 3720 | AC_CHECK_LIB(mail, maillock, have_mail=yes, have_mail=no) | 3706 | AC_CHECK_LIB(mail, maillock, have_mail=yes, have_mail=no) |
| @@ -3803,7 +3789,7 @@ AC_CHECK_FUNCS(accept4 fchdir gethostname \ | |||
| 3803 | getrusage get_current_dir_name \ | 3789 | getrusage get_current_dir_name \ |
| 3804 | lrand48 random rint \ | 3790 | lrand48 random rint \ |
| 3805 | select getpagesize setlocale newlocale \ | 3791 | select getpagesize setlocale newlocale \ |
| 3806 | getrlimit setrlimit shutdown getaddrinfo \ | 3792 | getrlimit setrlimit shutdown \ |
| 3807 | pthread_sigmask strsignal setitimer \ | 3793 | pthread_sigmask strsignal setitimer \ |
| 3808 | sendto recvfrom getsockname getpeername getifaddrs freeifaddrs \ | 3794 | sendto recvfrom getsockname getpeername getifaddrs freeifaddrs \ |
| 3809 | gai_strerror sync \ | 3795 | 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. | |||
| 2128 | 2128 | ||
| 2129 | The arguments @var{host} and @var{service} specify where to connect to; | 2129 | The arguments @var{host} and @var{service} specify where to connect to; |
| 2130 | @var{host} is the host name (a string), and @var{service} is the name of | 2130 | @var{host} is the host name (a string), and @var{service} is the name of |
| 2131 | a defined network service (a string) or a port number (an integer). | 2131 | a defined network service (a string) or a port number (an integer like |
| 2132 | @code{80} or an integer string like @code{"80"}). | ||
| 2132 | 2133 | ||
| 2133 | The remaining arguments @var{parameters} are keyword/argument pairs | 2134 | The remaining arguments @var{parameters} are keyword/argument pairs |
| 2134 | that are mainly relevant to encrypted connections: | 2135 | that are mainly relevant to encrypted connections: |
| @@ -2352,8 +2353,9 @@ connecting to that address will be accepted. | |||
| 2352 | 2353 | ||
| 2353 | @item :service @var{service} | 2354 | @item :service @var{service} |
| 2354 | @var{service} specifies a port number to connect to; or, for a server, | 2355 | @var{service} specifies a port number to connect to; or, for a server, |
| 2355 | the port number to listen on. It should be a service name that | 2356 | the port number to listen on. It should be a service name like |
| 2356 | translates to a port number, or an integer specifying the port number | 2357 | @samp{"http"} that translates to a port number, or an integer like @samp{80} |
| 2358 | or an integer string like @samp{"80"} that specifies the port number | ||
| 2357 | directly. For a server, it can also be @code{t}, which means to let | 2359 | directly. For a server, it can also be @code{t}, which means to let |
| 2358 | the system select an unused port number. | 2360 | the system select an unused port number. |
| 2359 | 2361 | ||
| @@ -74,11 +74,10 @@ to deal with asynchronous sockets is to avoid interacting with them | |||
| 74 | until they have changed status to "run". This is most easily done | 74 | until they have changed status to "run". This is most easily done |
| 75 | from a process sentinel. | 75 | from a process sentinel. |
| 76 | 76 | ||
| 77 | ** `make-network-stream' has always allowed :service to be specified | 77 | ** ‘make-network-process’ and ‘open-network-stream’ sometimes allowed |
| 78 | as a "number string" (i.e., :service "993") when using gethostbyname, | 78 | :service to be an integer string (e.g., :service "993") and sometimes |
| 79 | but has required using a real number (i.e., :service 993) on systems | 79 | required an integer (e.g., :service 993). This difference has been |
| 80 | without gethostbyname. This difference has now been eliminated, and | 80 | eliminated, and integer strings work everywhere. |
| 81 | you can use "number strings" on all systems. | ||
| 82 | 81 | ||
| 83 | ** It is possible to disable attempted recovery on fatal signals | 82 | ** It is possible to disable attempted recovery on fatal signals |
| 84 | 83 | ||
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 * */); | |||
| 102 | #endif /* ! KERBEROS5 */ | 102 | #endif /* ! KERBEROS5 */ |
| 103 | #endif /* KERBEROS */ | 103 | #endif /* KERBEROS */ |
| 104 | 104 | ||
| 105 | #ifndef WINDOWSNT | ||
| 106 | #ifndef HAVE_H_ERRNO | ||
| 107 | extern int h_errno; | ||
| 108 | #endif | ||
| 109 | #endif | ||
| 110 | |||
| 111 | static int socket_connection (char *, int); | 105 | static int socket_connection (char *, int); |
| 112 | static int pop_getline (popserver, char **); | 106 | static int pop_getline (popserver, char **); |
| 113 | static int sendline (popserver, const char *); | 107 | static int sendline (popserver, const char *); |
| @@ -972,13 +966,9 @@ static int have_winsock = 0; | |||
| 972 | static int | 966 | static int |
| 973 | socket_connection (char *host, int flags) | 967 | socket_connection (char *host, int flags) |
| 974 | { | 968 | { |
| 975 | #ifdef HAVE_GETADDRINFO | ||
| 976 | struct addrinfo *res, *it; | 969 | struct addrinfo *res, *it; |
| 977 | struct addrinfo hints; | 970 | struct addrinfo hints; |
| 978 | int ret; | 971 | int ret; |
| 979 | #else /* !HAVE_GETADDRINFO */ | ||
| 980 | struct hostent *hostent; | ||
| 981 | #endif | ||
| 982 | struct servent *servent; | 972 | struct servent *servent; |
| 983 | struct sockaddr_in addr; | 973 | struct sockaddr_in addr; |
| 984 | char found_port = 0; | 974 | char found_port = 0; |
| @@ -1065,7 +1055,6 @@ socket_connection (char *host, int flags) | |||
| 1065 | 1055 | ||
| 1066 | } | 1056 | } |
| 1067 | 1057 | ||
| 1068 | #ifdef HAVE_GETADDRINFO | ||
| 1069 | memset (&hints, 0, sizeof (hints)); | 1058 | memset (&hints, 0, sizeof (hints)); |
| 1070 | hints.ai_socktype = SOCK_STREAM; | 1059 | hints.ai_socktype = SOCK_STREAM; |
| 1071 | hints.ai_flags = AI_CANONNAME; | 1060 | hints.ai_flags = AI_CANONNAME; |
| @@ -1097,34 +1086,6 @@ socket_connection (char *host, int flags) | |||
| 1097 | } | 1086 | } |
| 1098 | freeaddrinfo (res); | 1087 | freeaddrinfo (res); |
| 1099 | 1088 | ||
| 1100 | #else /* !HAVE_GETADDRINFO */ | ||
| 1101 | do | ||
| 1102 | { | ||
| 1103 | hostent = gethostbyname (host); | ||
| 1104 | try_count++; | ||
| 1105 | if ((! hostent) && ((h_errno != TRY_AGAIN) || (try_count == 5))) | ||
| 1106 | { | ||
| 1107 | strcpy (pop_error, "Could not determine POP server's address"); | ||
| 1108 | return (-1); | ||
| 1109 | } | ||
| 1110 | } while (! hostent); | ||
| 1111 | |||
| 1112 | while (*hostent->h_addr_list) | ||
| 1113 | { | ||
| 1114 | memcpy (&addr.sin_addr, *hostent->h_addr_list, hostent->h_length); | ||
| 1115 | if (! connect (sock, (struct sockaddr *) &addr, sizeof (addr))) | ||
| 1116 | break; | ||
| 1117 | hostent->h_addr_list++; | ||
| 1118 | } | ||
| 1119 | connect_ok = *hostent->h_addr_list != NULL; | ||
| 1120 | if (! connect_ok) | ||
| 1121 | { | ||
| 1122 | realhost = alloca (strlen (hostent->h_name) + 1); | ||
| 1123 | strcpy (realhost, hostent->h_name); | ||
| 1124 | } | ||
| 1125 | |||
| 1126 | #endif /* !HAVE_GETADDRINFO */ | ||
| 1127 | |||
| 1128 | #define CONNECT_ERROR "Could not connect to POP server: " | 1089 | #define CONNECT_ERROR "Could not connect to POP server: " |
| 1129 | 1090 | ||
| 1130 | if (! connect_ok) | 1091 | 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." | |||
| 265 | (let ((v (match-string 3 host))) | 265 | (let ((v (match-string 3 host))) |
| 266 | (setq host (match-string 2 host)) | 266 | (setq host (match-string 2 host)) |
| 267 | (when (and (stringp v) (not (string= "" v))) | 267 | (when (and (stringp v) (not (string= "" v))) |
| 268 | (setq port | 268 | (setq port v)))) |
| 269 | (if (string-match "[^[:digit:]]" v) | ||
| 270 | (string-to-number v) | ||
| 271 | v))))) | ||
| 272 | (when (file-name-absolute-p host) | 269 | (when (file-name-absolute-p host) |
| 273 | ;; Expand file name because `file-name-absolute-p' | 270 | ;; Expand file name because `file-name-absolute-p' |
| 274 | ;; considers paths beginning with "~" as absolute | 271 | ;; 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. | |||
| 65 | Process output goes at end of that buffer. BUFFER may be nil, | 65 | Process output goes at end of that buffer. BUFFER may be nil, |
| 66 | meaning that the process is not associated with any buffer. | 66 | meaning that the process is not associated with any buffer. |
| 67 | HOST is the name or IP address of the host to connect to. | 67 | HOST is the name or IP address of the host to connect to. |
| 68 | SERVICE is the name of the service desired, or an integer specifying | 68 | SERVICE is the name of the service desired, or an integer or |
| 69 | a port number to connect to. | 69 | integer string specifying a port number to connect to. |
| 70 | 70 | ||
| 71 | The remaining PARAMETERS should be a sequence of keywords and | 71 | The remaining PARAMETERS should be a sequence of keywords and |
| 72 | values: | 72 | 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) | |||
| 3429 | 3429 | ||
| 3430 | } | 3430 | } |
| 3431 | 3431 | ||
| 3432 | #ifndef HAVE_GETADDRINFO | ||
| 3433 | static Lisp_Object | ||
| 3434 | conv_numerical_to_lisp (unsigned char *number, int length, int port) | ||
| 3435 | { | ||
| 3436 | Lisp_Object address = Fmake_vector (make_number (length + 1), Qnil); | ||
| 3437 | struct Lisp_Vector *p = XVECTOR (address); | ||
| 3438 | |||
| 3439 | p->contents[length] = make_number (port); | ||
| 3440 | for (int i = 0; i < length; i++) | ||
| 3441 | p->contents[i] = make_number (number[i]); | ||
| 3442 | |||
| 3443 | return address; | ||
| 3444 | } | ||
| 3445 | #endif | ||
| 3446 | |||
| 3447 | /* Create a network stream/datagram client/server process. Treated | 3432 | /* Create a network stream/datagram client/server process. Treated |
| 3448 | exactly like a normal process when reading and writing. Primary | 3433 | exactly like a normal process when reading and writing. Primary |
| 3449 | differences are in status display and process deletion. A network | 3434 | 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. | |||
| 3479 | 3464 | ||
| 3480 | :service SERVICE -- SERVICE is name of the service desired, or an | 3465 | :service SERVICE -- SERVICE is name of the service desired, or an |
| 3481 | integer specifying a port number to connect to. If SERVICE is t, | 3466 | integer specifying a port number to connect to. If SERVICE is t, |
| 3482 | a random port number is selected for the server. (If Emacs was | 3467 | a random port number is selected for the server. A port number can |
| 3483 | compiled with getaddrinfo, a port number can also be specified as a | 3468 | be specified as an integer string, e.g., "80", as well as an integer. |
| 3484 | string, e.g. "80", as well as an integer. This is not portable.) | ||
| 3485 | 3469 | ||
| 3486 | :type TYPE -- TYPE is the type of connection. The default (nil) is a | 3470 | :type TYPE -- TYPE is the type of connection. The default (nil) is a |
| 3487 | stream type connection, `datagram' creates a datagram type connection, | 3471 | stream type connection, `datagram' creates a datagram type connection, |
| @@ -3614,11 +3598,9 @@ usage: (make-network-process &rest ARGS) */) | |||
| 3614 | Lisp_Object proc; | 3598 | Lisp_Object proc; |
| 3615 | Lisp_Object contact; | 3599 | Lisp_Object contact; |
| 3616 | struct Lisp_Process *p; | 3600 | struct Lisp_Process *p; |
| 3617 | #if defined HAVE_GETADDRINFO || defined HAVE_GETADDRINFO_A | ||
| 3618 | const char *portstring; | 3601 | const char *portstring; |
| 3619 | ptrdiff_t portstringlen ATTRIBUTE_UNUSED; | 3602 | ptrdiff_t portstringlen ATTRIBUTE_UNUSED; |
| 3620 | char portbuf[INT_BUFSIZE_BOUND (EMACS_INT)]; | 3603 | char portbuf[INT_BUFSIZE_BOUND (EMACS_INT)]; |
| 3621 | #endif | ||
| 3622 | #ifdef HAVE_LOCAL_SOCKETS | 3604 | #ifdef HAVE_LOCAL_SOCKETS |
| 3623 | struct sockaddr_un address_un; | 3605 | struct sockaddr_un address_un; |
| 3624 | #endif | 3606 | #endif |
| @@ -3689,7 +3671,7 @@ usage: (make-network-process &rest ARGS) */) | |||
| 3689 | tem = Fplist_get (contact, QCfamily); | 3671 | tem = Fplist_get (contact, QCfamily); |
| 3690 | if (NILP (tem)) | 3672 | if (NILP (tem)) |
| 3691 | { | 3673 | { |
| 3692 | #if defined (HAVE_GETADDRINFO) && defined (AF_INET6) | 3674 | #ifdef AF_INET6 |
| 3693 | family = AF_UNSPEC; | 3675 | family = AF_UNSPEC; |
| 3694 | #else | 3676 | #else |
| 3695 | family = AF_INET; | 3677 | family = AF_INET; |
| @@ -3761,7 +3743,6 @@ usage: (make-network-process &rest ARGS) */) | |||
| 3761 | } | 3743 | } |
| 3762 | #endif | 3744 | #endif |
| 3763 | 3745 | ||
| 3764 | #if defined HAVE_GETADDRINFO || defined HAVE_GETADDRINFO_A | ||
| 3765 | if (!NILP (host)) | 3746 | if (!NILP (host)) |
| 3766 | { | 3747 | { |
| 3767 | /* SERVICE can either be a string or int. | 3748 | /* SERVICE can either be a string or int. |
| @@ -3783,7 +3764,6 @@ usage: (make-network-process &rest ARGS) */) | |||
| 3783 | portstringlen = SBYTES (service); | 3764 | portstringlen = SBYTES (service); |
| 3784 | } | 3765 | } |
| 3785 | } | 3766 | } |
| 3786 | #endif | ||
| 3787 | 3767 | ||
| 3788 | #ifdef HAVE_GETADDRINFO_A | 3768 | #ifdef HAVE_GETADDRINFO_A |
| 3789 | if (!NILP (host) && !NILP (Fplist_get (contact, QCnowait))) | 3769 | if (!NILP (host) && !NILP (Fplist_get (contact, QCnowait))) |
| @@ -3815,7 +3795,6 @@ usage: (make-network-process &rest ARGS) */) | |||
| 3815 | } | 3795 | } |
| 3816 | #endif /* HAVE_GETADDRINFO_A */ | 3796 | #endif /* HAVE_GETADDRINFO_A */ |
| 3817 | 3797 | ||
| 3818 | #ifdef HAVE_GETADDRINFO | ||
| 3819 | /* If we have a host, use getaddrinfo to resolve both host and service. | 3798 | /* If we have a host, use getaddrinfo to resolve both host and service. |
| 3820 | Otherwise, use getservbyname to lookup the service. */ | 3799 | Otherwise, use getservbyname to lookup the service. */ |
| 3821 | 3800 | ||
| @@ -3855,10 +3834,8 @@ usage: (make-network-process &rest ARGS) */) | |||
| 3855 | 3834 | ||
| 3856 | goto open_socket; | 3835 | goto open_socket; |
| 3857 | } | 3836 | } |
| 3858 | #endif /* HAVE_GETADDRINFO */ | ||
| 3859 | 3837 | ||
| 3860 | /* We end up here if getaddrinfo is not defined, or in case no hostname | 3838 | /* No hostname has been specified (e.g., a local server process). */ |
| 3861 | has been specified (e.g. for a local server process). */ | ||
| 3862 | 3839 | ||
| 3863 | if (EQ (service, Qt)) | 3840 | if (EQ (service, Qt)) |
| 3864 | port = 0; | 3841 | port = 0; |
| @@ -3894,43 +3871,6 @@ usage: (make-network-process &rest ARGS) */) | |||
| 3894 | xsignal1 (Qerror, CALLN (Fformat, unknown_service, service)); | 3871 | xsignal1 (Qerror, CALLN (Fformat, unknown_service, service)); |
| 3895 | } | 3872 | } |
| 3896 | 3873 | ||
| 3897 | #ifndef HAVE_GETADDRINFO | ||
| 3898 | if (!NILP (host)) | ||
| 3899 | { | ||
| 3900 | struct hostent *host_info_ptr; | ||
| 3901 | unsigned char *addr; | ||
| 3902 | int addrlen; | ||
| 3903 | |||
| 3904 | /* gethostbyname may fail with TRY_AGAIN, but we don't honor that, | ||
| 3905 | as it may `hang' Emacs for a very long time. */ | ||
| 3906 | immediate_quit = 1; | ||
| 3907 | QUIT; | ||
| 3908 | |||
| 3909 | host_info_ptr = gethostbyname ((const char *) SDATA (host)); | ||
| 3910 | immediate_quit = 0; | ||
| 3911 | |||
| 3912 | if (host_info_ptr) | ||
| 3913 | { | ||
| 3914 | addr = (unsigned char *) host_info_ptr->h_addr; | ||
| 3915 | addrlen = host_info_ptr->h_length; | ||
| 3916 | } | ||
| 3917 | else | ||
| 3918 | /* Attempt to interpret host as numeric inet address. This | ||
| 3919 | only works for IPv4 addresses. */ | ||
| 3920 | { | ||
| 3921 | unsigned long numeric_addr = inet_addr (SSDATA (host)); | ||
| 3922 | |||
| 3923 | if (numeric_addr == -1) | ||
| 3924 | error ("Unknown host \"%s\"", SDATA (host)); | ||
| 3925 | |||
| 3926 | addr = (unsigned char *) &numeric_addr; | ||
| 3927 | addrlen = 4; | ||
| 3928 | } | ||
| 3929 | |||
| 3930 | ip_addresses = list1 (conv_numerical_to_lisp (addr, addrlen, port)); | ||
| 3931 | } | ||
| 3932 | #endif /* not HAVE_GETADDRINFO */ | ||
| 3933 | |||
| 3934 | open_socket: | 3874 | open_socket: |
| 3935 | 3875 | ||
| 3936 | if (!NILP (buffer)) | 3876 | if (!NILP (buffer)) |