summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2011-03-20 09:55:33 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2011-03-20 09:55:33 -0700
commitc184bbfdfd547bbf61e719be92460dcebaed85a3 (patch)
treeb2f9baa65e77cbbc7dfc6ef92d34e60b0ce140d2 /src
parentc939f91b4d9d7830daf4e17cacbab1709ce9949d (diff)
parent6a90a4f1982c25213ec70637b52462674c2564bd (diff)
Merge: Use socklen_t, not int, for socket lengths.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog8
-rw-r--r--src/config.in6
-rw-r--r--src/process.c13
3 files changed, 21 insertions, 6 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 744d3ef53f0..0b2a0d44c5f 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,13 @@
2011-03-20 Paul Eggert <eggert@cs.ucla.edu>
+ * process.c (Fmake_network_process): Use socklen_t, not int,
+ where POSIX says socklen_t is required in portable programs.
+ This fixes a porting bug on hosts like 64-bit HP-UX, where
+ socklen_t is wider than int (Bug#8277).
+ (Fmake_network_process, server_accept_connection):
+ (wait_reading_process_output, read_process_output):
+ Likewise.
+
* process.c: Rename or move locals to avoid shadowing.
(list_processes_1, Fmake_network_process):
(read_process_output_error_handler, exec_sentinel_error_handler):
diff --git a/src/config.in b/src/config.in
index fbd3ee9338d..b24aacd4e54 100644
--- a/src/config.in
+++ b/src/config.in
@@ -833,6 +833,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
/* Define to 1 if `vfork' works. */
#undef HAVE_WORKING_VFORK
+/* Define to 1 if you have the <ws2tcpip.h> header file. */
+#undef HAVE_WS2TCPIP_H
+
/* Define to 1 if you want to use version 11 of X windows. Otherwise, Emacs
expects to use version 10. */
#undef HAVE_X11
@@ -1209,6 +1212,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
/* Define to `unsigned int' if <sys/types.h> does not define. */
#undef size_t
+/* type to use in place of socklen_t if not defined */
+#undef socklen_t
+
/* Define to any substitute for sys_siglist. */
#undef sys_siglist
diff --git a/src/process.c b/src/process.c
index 5ee731a5bd3..4a7202388bf 100644
--- a/src/process.c
+++ b/src/process.c
@@ -3461,7 +3461,7 @@ usage: (make-network-process &rest ARGS) */)
if (EQ (service, Qt))
{
struct sockaddr_in sa1;
- int len1 = sizeof (sa1);
+ socklen_t len1 = sizeof (sa1);
if (getsockname (s, (struct sockaddr *)&sa1, &len1) == 0)
{
((struct sockaddr_in *)(lres->ai_addr))->sin_port = sa1.sin_port;
@@ -3508,7 +3508,8 @@ usage: (make-network-process &rest ARGS) */)
/* Unlike most other syscalls connect() cannot be called
again. (That would return EALREADY.) The proper way to
wait for completion is select(). */
- int sc, len;
+ int sc;
+ socklen_t len;
SELECT_TYPE fdset;
retry_select:
FD_ZERO (&fdset);
@@ -3581,7 +3582,7 @@ usage: (make-network-process &rest ARGS) */)
if (!is_server)
{
struct sockaddr_in sa1;
- int len1 = sizeof (sa1);
+ socklen_t len1 = sizeof (sa1);
if (getsockname (s, (struct sockaddr *)&sa1, &len1) == 0)
contact = Fplist_put (contact, QClocal,
conv_sockaddr_to_lisp ((struct sockaddr *)&sa1, len1));
@@ -4186,7 +4187,7 @@ server_accept_connection (Lisp_Object server, int channel)
struct sockaddr_un un;
#endif
} saddr;
- int len = sizeof saddr;
+ socklen_t len = sizeof saddr;
s = accept (channel, &saddr.sa, &len);
@@ -5051,7 +5052,7 @@ wait_reading_process_output (int time_limit, int microsecs, int read_kbd,
/* getsockopt(,,SO_ERROR,,) is said to hang on some systems.
So only use it on systems where it is known to work. */
{
- int xlen = sizeof (xerrno);
+ socklen_t xlen = sizeof (xerrno);
if (getsockopt (channel, SOL_SOCKET, SO_ERROR, &xerrno, &xlen))
xerrno = errno;
}
@@ -5163,7 +5164,7 @@ read_process_output (Lisp_Object proc, register int channel)
/* We have a working select, so proc_buffered_char is always -1. */
if (DATAGRAM_CHAN_P (channel))
{
- int len = datagram_address[channel].len;
+ socklen_t len = datagram_address[channel].len;
nbytes = recvfrom (channel, chars + carryover, readmax,
0, datagram_address[channel].sa, &len);
}