diff options
| author | Paul Eggert | 2011-03-20 09:55:33 -0700 |
|---|---|---|
| committer | Paul Eggert | 2011-03-20 09:55:33 -0700 |
| commit | c184bbfdfd547bbf61e719be92460dcebaed85a3 (patch) | |
| tree | b2f9baa65e77cbbc7dfc6ef92d34e60b0ce140d2 /src | |
| parent | c939f91b4d9d7830daf4e17cacbab1709ce9949d (diff) | |
| parent | 6a90a4f1982c25213ec70637b52462674c2564bd (diff) | |
| download | emacs-c184bbfdfd547bbf61e719be92460dcebaed85a3.tar.gz emacs-c184bbfdfd547bbf61e719be92460dcebaed85a3.zip | |
Merge: Use socklen_t, not int, for socket lengths.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 8 | ||||
| -rw-r--r-- | src/config.in | 6 | ||||
| -rw-r--r-- | src/process.c | 13 |
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 @@ | |||
| 1 | 2011-03-20 Paul Eggert <eggert@cs.ucla.edu> | 1 | 2011-03-20 Paul Eggert <eggert@cs.ucla.edu> |
| 2 | 2 | ||
| 3 | * process.c (Fmake_network_process): Use socklen_t, not int, | ||
| 4 | where POSIX says socklen_t is required in portable programs. | ||
| 5 | This fixes a porting bug on hosts like 64-bit HP-UX, where | ||
| 6 | socklen_t is wider than int (Bug#8277). | ||
| 7 | (Fmake_network_process, server_accept_connection): | ||
| 8 | (wait_reading_process_output, read_process_output): | ||
| 9 | Likewise. | ||
| 10 | |||
| 3 | * process.c: Rename or move locals to avoid shadowing. | 11 | * process.c: Rename or move locals to avoid shadowing. |
| 4 | (list_processes_1, Fmake_network_process): | 12 | (list_processes_1, Fmake_network_process): |
| 5 | (read_process_output_error_handler, exec_sentinel_error_handler): | 13 | (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/>. */ | |||
| 833 | /* Define to 1 if `vfork' works. */ | 833 | /* Define to 1 if `vfork' works. */ |
| 834 | #undef HAVE_WORKING_VFORK | 834 | #undef HAVE_WORKING_VFORK |
| 835 | 835 | ||
| 836 | /* Define to 1 if you have the <ws2tcpip.h> header file. */ | ||
| 837 | #undef HAVE_WS2TCPIP_H | ||
| 838 | |||
| 836 | /* Define to 1 if you want to use version 11 of X windows. Otherwise, Emacs | 839 | /* Define to 1 if you want to use version 11 of X windows. Otherwise, Emacs |
| 837 | expects to use version 10. */ | 840 | expects to use version 10. */ |
| 838 | #undef HAVE_X11 | 841 | #undef HAVE_X11 |
| @@ -1209,6 +1212,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 1209 | /* Define to `unsigned int' if <sys/types.h> does not define. */ | 1212 | /* Define to `unsigned int' if <sys/types.h> does not define. */ |
| 1210 | #undef size_t | 1213 | #undef size_t |
| 1211 | 1214 | ||
| 1215 | /* type to use in place of socklen_t if not defined */ | ||
| 1216 | #undef socklen_t | ||
| 1217 | |||
| 1212 | /* Define to any substitute for sys_siglist. */ | 1218 | /* Define to any substitute for sys_siglist. */ |
| 1213 | #undef sys_siglist | 1219 | #undef sys_siglist |
| 1214 | 1220 | ||
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) */) | |||
| 3461 | if (EQ (service, Qt)) | 3461 | if (EQ (service, Qt)) |
| 3462 | { | 3462 | { |
| 3463 | struct sockaddr_in sa1; | 3463 | struct sockaddr_in sa1; |
| 3464 | int len1 = sizeof (sa1); | 3464 | socklen_t len1 = sizeof (sa1); |
| 3465 | if (getsockname (s, (struct sockaddr *)&sa1, &len1) == 0) | 3465 | if (getsockname (s, (struct sockaddr *)&sa1, &len1) == 0) |
| 3466 | { | 3466 | { |
| 3467 | ((struct sockaddr_in *)(lres->ai_addr))->sin_port = sa1.sin_port; | 3467 | ((struct sockaddr_in *)(lres->ai_addr))->sin_port = sa1.sin_port; |
| @@ -3508,7 +3508,8 @@ usage: (make-network-process &rest ARGS) */) | |||
| 3508 | /* Unlike most other syscalls connect() cannot be called | 3508 | /* Unlike most other syscalls connect() cannot be called |
| 3509 | again. (That would return EALREADY.) The proper way to | 3509 | again. (That would return EALREADY.) The proper way to |
| 3510 | wait for completion is select(). */ | 3510 | wait for completion is select(). */ |
| 3511 | int sc, len; | 3511 | int sc; |
| 3512 | socklen_t len; | ||
| 3512 | SELECT_TYPE fdset; | 3513 | SELECT_TYPE fdset; |
| 3513 | retry_select: | 3514 | retry_select: |
| 3514 | FD_ZERO (&fdset); | 3515 | FD_ZERO (&fdset); |
| @@ -3581,7 +3582,7 @@ usage: (make-network-process &rest ARGS) */) | |||
| 3581 | if (!is_server) | 3582 | if (!is_server) |
| 3582 | { | 3583 | { |
| 3583 | struct sockaddr_in sa1; | 3584 | struct sockaddr_in sa1; |
| 3584 | int len1 = sizeof (sa1); | 3585 | socklen_t len1 = sizeof (sa1); |
| 3585 | if (getsockname (s, (struct sockaddr *)&sa1, &len1) == 0) | 3586 | if (getsockname (s, (struct sockaddr *)&sa1, &len1) == 0) |
| 3586 | contact = Fplist_put (contact, QClocal, | 3587 | contact = Fplist_put (contact, QClocal, |
| 3587 | conv_sockaddr_to_lisp ((struct sockaddr *)&sa1, len1)); | 3588 | conv_sockaddr_to_lisp ((struct sockaddr *)&sa1, len1)); |
| @@ -4186,7 +4187,7 @@ server_accept_connection (Lisp_Object server, int channel) | |||
| 4186 | struct sockaddr_un un; | 4187 | struct sockaddr_un un; |
| 4187 | #endif | 4188 | #endif |
| 4188 | } saddr; | 4189 | } saddr; |
| 4189 | int len = sizeof saddr; | 4190 | socklen_t len = sizeof saddr; |
| 4190 | 4191 | ||
| 4191 | s = accept (channel, &saddr.sa, &len); | 4192 | s = accept (channel, &saddr.sa, &len); |
| 4192 | 4193 | ||
| @@ -5051,7 +5052,7 @@ wait_reading_process_output (int time_limit, int microsecs, int read_kbd, | |||
| 5051 | /* getsockopt(,,SO_ERROR,,) is said to hang on some systems. | 5052 | /* getsockopt(,,SO_ERROR,,) is said to hang on some systems. |
| 5052 | So only use it on systems where it is known to work. */ | 5053 | So only use it on systems where it is known to work. */ |
| 5053 | { | 5054 | { |
| 5054 | int xlen = sizeof (xerrno); | 5055 | socklen_t xlen = sizeof (xerrno); |
| 5055 | if (getsockopt (channel, SOL_SOCKET, SO_ERROR, &xerrno, &xlen)) | 5056 | if (getsockopt (channel, SOL_SOCKET, SO_ERROR, &xerrno, &xlen)) |
| 5056 | xerrno = errno; | 5057 | xerrno = errno; |
| 5057 | } | 5058 | } |
| @@ -5163,7 +5164,7 @@ read_process_output (Lisp_Object proc, register int channel) | |||
| 5163 | /* We have a working select, so proc_buffered_char is always -1. */ | 5164 | /* We have a working select, so proc_buffered_char is always -1. */ |
| 5164 | if (DATAGRAM_CHAN_P (channel)) | 5165 | if (DATAGRAM_CHAN_P (channel)) |
| 5165 | { | 5166 | { |
| 5166 | int len = datagram_address[channel].len; | 5167 | socklen_t len = datagram_address[channel].len; |
| 5167 | nbytes = recvfrom (channel, chars + carryover, readmax, | 5168 | nbytes = recvfrom (channel, chars + carryover, readmax, |
| 5168 | 0, datagram_address[channel].sa, &len); | 5169 | 0, datagram_address[channel].sa, &len); |
| 5169 | } | 5170 | } |