aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Eggert2011-03-17 20:30:24 -0700
committerPaul Eggert2011-03-17 20:30:24 -0700
commit401bf9b4708c19d3c86c888ce482014ca559a5b8 (patch)
treed69e75d88c70f4c5d3da2501b4afec51cf51d563
parenta3a6c54ec72118e8d22d2ecd608df5193c8926a3 (diff)
downloademacs-401bf9b4708c19d3c86c888ce482014ca559a5b8.tar.gz
emacs-401bf9b4708c19d3c86c888ce482014ca559a5b8.zip
process.c: Use socklen_t, not int, for socket lengths.
-rw-r--r--ChangeLog6
-rw-r--r--Makefile.in2
-rw-r--r--aclocal.m41
-rwxr-xr-xconfigure75
-rw-r--r--configure.in1
-rw-r--r--lib/Makefile.in19
-rw-r--r--lib/gnulib.mk2
-rw-r--r--m4/gl-comp.m44
-rw-r--r--m4/socklen.m465
-rw-r--r--src/ChangeLog10
-rw-r--r--src/config.in3
-rw-r--r--src/process.c13
12 files changed, 171 insertions, 30 deletions
diff --git a/ChangeLog b/ChangeLog
index fdde50669b5..8928b2aceeb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
12011-03-17 Paul Eggert <eggert@cs.ucla.edu>
2
3 * Makefile.in (GNULIB_MODULES): Add socklen.
4 * configure.in: Do not check for sys/socket.h, since socklen does that.
5 * m4/socklen.m4: New automatically-generated file, from gnulib.
6
12011-03-13 Paul Eggert <eggert@cs.ucla.edu> 72011-03-13 Paul Eggert <eggert@cs.ucla.edu>
2 8
3 Update for gnulib. 9 Update for gnulib.
diff --git a/Makefile.in b/Makefile.in
index 19267f82121..bc8ae5a9589 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -332,7 +332,7 @@ DOS_gnulib_comp.m4 = gl-comp.m4
332# as per $(gnulib_srcdir)/DEPENDENCIES. 332# as per $(gnulib_srcdir)/DEPENDENCIES.
333GNULIB_MODULES = \ 333GNULIB_MODULES = \
334 crypto/md5 dtoastr filemode getloadavg getopt-gnu \ 334 crypto/md5 dtoastr filemode getloadavg getopt-gnu \
335 ignore-value intprops lstat mktime readlink strftime symlink sys_stat 335 ignore-value intprops lstat mktime readlink socklen strftime symlink sys_stat
336GNULIB_TOOL_FLAGS = \ 336GNULIB_TOOL_FLAGS = \
337 --import --no-changelog --no-vc-files --makefile-name=gnulib.mk 337 --import --no-changelog --no-vc-files --makefile-name=gnulib.mk
338sync-from-gnulib: $(gnulib_srcdir) 338sync-from-gnulib: $(gnulib_srcdir)
diff --git a/aclocal.m4 b/aclocal.m4
index 1536f3b48b5..9bd85a88bbe 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -999,6 +999,7 @@ m4_include([m4/md5.m4])
999m4_include([m4/mktime.m4]) 999m4_include([m4/mktime.m4])
1000m4_include([m4/multiarch.m4]) 1000m4_include([m4/multiarch.m4])
1001m4_include([m4/readlink.m4]) 1001m4_include([m4/readlink.m4])
1002m4_include([m4/socklen.m4])
1002m4_include([m4/st_dm_mode.m4]) 1003m4_include([m4/st_dm_mode.m4])
1003m4_include([m4/stat.m4]) 1004m4_include([m4/stat.m4])
1004m4_include([m4/stdbool.m4]) 1005m4_include([m4/stdbool.m4])
diff --git a/configure b/configure
index 57ecd9d52eb..eed1c70599e 100755
--- a/configure
+++ b/configure
@@ -2960,6 +2960,7 @@ as_fn_append ac_header_list " getopt.h"
2960as_fn_append ac_func_list " lstat" 2960as_fn_append ac_func_list " lstat"
2961as_fn_append ac_func_list " alarm" 2961as_fn_append ac_func_list " alarm"
2962as_fn_append ac_func_list " readlink" 2962as_fn_append ac_func_list " readlink"
2963as_fn_append ac_header_list " sys/socket.h"
2963as_fn_append ac_header_list " wchar.h" 2964as_fn_append ac_header_list " wchar.h"
2964as_fn_append ac_header_list " stdint.h" 2965as_fn_append ac_header_list " stdint.h"
2965as_fn_append ac_func_list " tzset" 2966as_fn_append ac_func_list " tzset"
@@ -6141,6 +6142,7 @@ $as_echo "$ac_cv_safe_to_define___extensions__" >&6; }
6141 # Code from module mktime: 6142 # Code from module mktime:
6142 # Code from module multiarch: 6143 # Code from module multiarch:
6143 # Code from module readlink: 6144 # Code from module readlink:
6145 # Code from module socklen:
6144 # Code from module stat: 6146 # Code from module stat:
6145 # Code from module stdbool: 6147 # Code from module stdbool:
6146 # Code from module stddef: 6148 # Code from module stddef:
@@ -7966,18 +7968,6 @@ $as_echo "#define NO_MATHERR 1" >>confdefs.h
7966 7968
7967fi 7969fi
7968 7970
7969for ac_header in sys/socket.h
7970do :
7971 ac_fn_c_check_header_mongrel "$LINENO" "sys/socket.h" "ac_cv_header_sys_socket_h" "$ac_includes_default"
7972if test "x$ac_cv_header_sys_socket_h" = xyes; then :
7973 cat >>confdefs.h <<_ACEOF
7974#define HAVE_SYS_SOCKET_H 1
7975_ACEOF
7976
7977fi
7978
7979done
7980
7981for ac_header in net/if.h 7971for ac_header in net/if.h
7982do : 7972do :
7983 ac_fn_c_check_header_compile "$LINENO" "net/if.h" "ac_cv_header_net_if_h" "$ac_includes_default 7973 ac_fn_c_check_header_compile "$LINENO" "net/if.h" "ac_cv_header_net_if_h" "$ac_includes_default
@@ -14784,6 +14774,10 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
14784 14774
14785 14775
14786 14776
14777
14778
14779
14780
14787{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for stdbool.h that conforms to C99" >&5 14781{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for stdbool.h that conforms to C99" >&5
14788$as_echo_n "checking for stdbool.h that conforms to C99... " >&6; } 14782$as_echo_n "checking for stdbool.h that conforms to C99... " >&6; }
14789if ${ac_cv_header_stdbool_h+:} false; then : 14783if ${ac_cv_header_stdbool_h+:} false; then :
@@ -16356,6 +16350,63 @@ $as_echo "#define READLINK_TRAILING_SLASH_BUG 1" >>confdefs.h
16356 16350
16357 16351
16358 16352
16353 # Code from module socklen:
16354 ac_fn_c_check_type "$LINENO" "socklen_t" "ac_cv_type_socklen_t" "#include <sys/types.h>
16355 #if HAVE_SYS_SOCKET_H
16356 # include <sys/socket.h>
16357 #endif
16358"
16359if test "x$ac_cv_type_socklen_t" = xyes; then :
16360
16361else
16362 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for socklen_t equivalent" >&5
16363$as_echo_n "checking for socklen_t equivalent... " >&6; }
16364 if ${gl_cv_socklen_t_equiv+:} false; then :
16365 $as_echo_n "(cached) " >&6
16366else
16367 # Systems have either "struct sockaddr *" or
16368 # "void *" as the second argument to getpeername
16369 gl_cv_socklen_t_equiv=
16370 for arg2 in "struct sockaddr" void; do
16371 for t in int size_t "unsigned int" "long int" "unsigned long int"; do
16372 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
16373/* end confdefs.h. */
16374#include <sys/types.h>
16375 #include <sys/socket.h>
16376
16377 int getpeername (int, $arg2 *, $t *);
16378int
16379main ()
16380{
16381$t len;
16382 getpeername (0, 0, &len);
16383 ;
16384 return 0;
16385}
16386_ACEOF
16387if ac_fn_c_try_compile "$LINENO"; then :
16388 gl_cv_socklen_t_equiv="$t"
16389fi
16390rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
16391 test "$gl_cv_socklen_t_equiv" != "" && break
16392 done
16393 test "$gl_cv_socklen_t_equiv" != "" && break
16394 done
16395
16396fi
16397
16398 if test "$gl_cv_socklen_t_equiv" = ""; then
16399 as_fn_error $? "Cannot find a type to use in place of socklen_t" "$LINENO" 5
16400 fi
16401 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_socklen_t_equiv" >&5
16402$as_echo "$gl_cv_socklen_t_equiv" >&6; }
16403
16404cat >>confdefs.h <<_ACEOF
16405#define socklen_t $gl_cv_socklen_t_equiv
16406_ACEOF
16407
16408fi
16409
16359 # Code from module stat: 16410 # Code from module stat:
16360 16411
16361 16412
diff --git a/configure.in b/configure.in
index 086a7e12d67..11b7ad4db05 100644
--- a/configure.in
+++ b/configure.in
@@ -1265,7 +1265,6 @@ if test $emacs_cv_struct_exception != yes; then
1265 AC_DEFINE(NO_MATHERR, 1, [Define to 1 if you don't have struct exception in math.h.]) 1265 AC_DEFINE(NO_MATHERR, 1, [Define to 1 if you don't have struct exception in math.h.])
1266fi 1266fi
1267 1267
1268AC_CHECK_HEADERS(sys/socket.h)
1269AC_CHECK_HEADERS(net/if.h, , , [AC_INCLUDES_DEFAULT 1268AC_CHECK_HEADERS(net/if.h, , , [AC_INCLUDES_DEFAULT
1270#if HAVE_SYS_SOCKET_H 1269#if HAVE_SYS_SOCKET_H
1271#include <sys/socket.h> 1270#include <sys/socket.h>
diff --git a/lib/Makefile.in b/lib/Makefile.in
index 502b3dbb927..8be57520014 100644
--- a/lib/Makefile.in
+++ b/lib/Makefile.in
@@ -24,7 +24,7 @@
24# the same distribution terms as the rest of that program. 24# the same distribution terms as the rest of that program.
25# 25#
26# Generated by gnulib-tool. 26# Generated by gnulib-tool.
27# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=. --makefile-name=gnulib.mk --no-libtool --macro-prefix=gl --no-vc-files crypto/md5 dtoastr filemode getloadavg getopt-gnu ignore-value intprops lstat mktime readlink strftime symlink sys_stat 27# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=. --makefile-name=gnulib.mk --no-libtool --macro-prefix=gl --no-vc-files crypto/md5 dtoastr filemode getloadavg getopt-gnu ignore-value intprops lstat mktime readlink socklen strftime symlink sys_stat
28 28
29VPATH = @srcdir@ 29VPATH = @srcdir@
30pkgdatadir = $(datadir)/@PACKAGE@ 30pkgdatadir = $(datadir)/@PACKAGE@
@@ -57,14 +57,15 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/00gnulib.m4 \
57 $(top_srcdir)/m4/include_next.m4 $(top_srcdir)/m4/longlong.m4 \ 57 $(top_srcdir)/m4/include_next.m4 $(top_srcdir)/m4/longlong.m4 \
58 $(top_srcdir)/m4/lstat.m4 $(top_srcdir)/m4/md5.m4 \ 58 $(top_srcdir)/m4/lstat.m4 $(top_srcdir)/m4/md5.m4 \
59 $(top_srcdir)/m4/mktime.m4 $(top_srcdir)/m4/multiarch.m4 \ 59 $(top_srcdir)/m4/mktime.m4 $(top_srcdir)/m4/multiarch.m4 \
60 $(top_srcdir)/m4/readlink.m4 $(top_srcdir)/m4/st_dm_mode.m4 \ 60 $(top_srcdir)/m4/readlink.m4 $(top_srcdir)/m4/socklen.m4 \
61 $(top_srcdir)/m4/stat.m4 $(top_srcdir)/m4/stdbool.m4 \ 61 $(top_srcdir)/m4/st_dm_mode.m4 $(top_srcdir)/m4/stat.m4 \
62 $(top_srcdir)/m4/stddef_h.m4 $(top_srcdir)/m4/stdint.m4 \ 62 $(top_srcdir)/m4/stdbool.m4 $(top_srcdir)/m4/stddef_h.m4 \
63 $(top_srcdir)/m4/stdlib_h.m4 $(top_srcdir)/m4/strftime.m4 \ 63 $(top_srcdir)/m4/stdint.m4 $(top_srcdir)/m4/stdlib_h.m4 \
64 $(top_srcdir)/m4/symlink.m4 $(top_srcdir)/m4/sys_stat_h.m4 \ 64 $(top_srcdir)/m4/strftime.m4 $(top_srcdir)/m4/symlink.m4 \
65 $(top_srcdir)/m4/time_h.m4 $(top_srcdir)/m4/time_r.m4 \ 65 $(top_srcdir)/m4/sys_stat_h.m4 $(top_srcdir)/m4/time_h.m4 \
66 $(top_srcdir)/m4/tm_gmtoff.m4 $(top_srcdir)/m4/unistd_h.m4 \ 66 $(top_srcdir)/m4/time_r.m4 $(top_srcdir)/m4/tm_gmtoff.m4 \
67 $(top_srcdir)/m4/wchar_t.m4 $(top_srcdir)/configure.in 67 $(top_srcdir)/m4/unistd_h.m4 $(top_srcdir)/m4/wchar_t.m4 \
68 $(top_srcdir)/configure.in
68am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ 69am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
69 $(ACLOCAL_M4) 70 $(ACLOCAL_M4)
70mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs 71mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
diff --git a/lib/gnulib.mk b/lib/gnulib.mk
index cd6a1d00c15..369b7a48732 100644
--- a/lib/gnulib.mk
+++ b/lib/gnulib.mk
@@ -9,7 +9,7 @@
9# the same distribution terms as the rest of that program. 9# the same distribution terms as the rest of that program.
10# 10#
11# Generated by gnulib-tool. 11# Generated by gnulib-tool.
12# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=. --makefile-name=gnulib.mk --no-libtool --macro-prefix=gl --no-vc-files crypto/md5 dtoastr filemode getloadavg getopt-gnu ignore-value intprops lstat mktime readlink strftime symlink sys_stat 12# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=. --makefile-name=gnulib.mk --no-libtool --macro-prefix=gl --no-vc-files crypto/md5 dtoastr filemode getloadavg getopt-gnu ignore-value intprops lstat mktime readlink socklen strftime symlink sys_stat
13 13
14 14
15MOSTLYCLEANFILES += core *.stackdump 15MOSTLYCLEANFILES += core *.stackdump
diff --git a/m4/gl-comp.m4 b/m4/gl-comp.m4
index 8bf5a64a5f9..7f8b5a79070 100644
--- a/m4/gl-comp.m4
+++ b/m4/gl-comp.m4
@@ -45,6 +45,7 @@ AC_DEFUN([gl_EARLY],
45 # Code from module mktime: 45 # Code from module mktime:
46 # Code from module multiarch: 46 # Code from module multiarch:
47 # Code from module readlink: 47 # Code from module readlink:
48 # Code from module socklen:
48 # Code from module stat: 49 # Code from module stat:
49 # Code from module stdbool: 50 # Code from module stdbool:
50 # Code from module stddef: 51 # Code from module stddef:
@@ -111,6 +112,8 @@ AC_DEFUN([gl_INIT],
111 # Code from module readlink: 112 # Code from module readlink:
112 gl_FUNC_READLINK 113 gl_FUNC_READLINK
113 gl_UNISTD_MODULE_INDICATOR([readlink]) 114 gl_UNISTD_MODULE_INDICATOR([readlink])
115 # Code from module socklen:
116 gl_TYPE_SOCKLEN_T
114 # Code from module stat: 117 # Code from module stat:
115 gl_FUNC_STAT 118 gl_FUNC_STAT
116 gl_SYS_STAT_MODULE_INDICATOR([stat]) 119 gl_SYS_STAT_MODULE_INDICATOR([stat])
@@ -327,6 +330,7 @@ AC_DEFUN([gl_FILE_LIST], [
327 m4/mktime.m4 330 m4/mktime.m4
328 m4/multiarch.m4 331 m4/multiarch.m4
329 m4/readlink.m4 332 m4/readlink.m4
333 m4/socklen.m4
330 m4/st_dm_mode.m4 334 m4/st_dm_mode.m4
331 m4/stat.m4 335 m4/stat.m4
332 m4/stdbool.m4 336 m4/stdbool.m4
diff --git a/m4/socklen.m4 b/m4/socklen.m4
new file mode 100644
index 00000000000..28dcf070463
--- /dev/null
+++ b/m4/socklen.m4
@@ -0,0 +1,65 @@
1# socklen.m4 serial 9
2dnl Copyright (C) 2005-2007, 2009-2011 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved.
6
7dnl From Albert Chin, Windows fixes from Simon Josefsson.
8
9dnl Check for socklen_t: historically on BSD it is an int, and in
10dnl POSIX 1g it is a type of its own, but some platforms use different
11dnl types for the argument to getsockopt, getpeername, etc.:
12dnl HP-UX 10.20, IRIX 6.5, Interix 3.5, BeOS.
13dnl So we have to test to find something that will work.
14
15dnl On mingw32, socklen_t is in ws2tcpip.h ('int'), so we try to find
16dnl it there first. That file is included by gnulib's sys_socket.in.h, which
17dnl all users of this module should include if they want to be portable to
18dnl mingw32. Cygwin must not include ws2tcpip.h.
19AC_DEFUN([gl_TYPE_SOCKLEN_T],
20 [AC_REQUIRE([gl_PREREQ_TYPE_SOCKLEN_T])dnl
21 AC_CHECK_TYPE([socklen_t], ,
22 [AC_MSG_CHECKING([for socklen_t equivalent])
23 AC_CACHE_VAL([gl_cv_socklen_t_equiv],
24 [# Systems have either "struct sockaddr *" or
25 # "void *" as the second argument to getpeername
26 gl_cv_socklen_t_equiv=
27 for arg2 in "struct sockaddr" void; do
28 for t in int size_t "unsigned int" "long int" "unsigned long int"; do
29 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
30 [[#include <sys/types.h>
31 #include <sys/socket.h>
32
33 int getpeername (int, $arg2 *, $t *);]],
34 [[$t len;
35 getpeername (0, 0, &len);]])],
36 [gl_cv_socklen_t_equiv="$t"])
37 test "$gl_cv_socklen_t_equiv" != "" && break
38 done
39 test "$gl_cv_socklen_t_equiv" != "" && break
40 done
41 ])
42 if test "$gl_cv_socklen_t_equiv" = ""; then
43 AC_MSG_ERROR([Cannot find a type to use in place of socklen_t])
44 fi
45 AC_MSG_RESULT([$gl_cv_socklen_t_equiv])
46 AC_DEFINE_UNQUOTED([socklen_t], [$gl_cv_socklen_t_equiv],
47 [type to use in place of socklen_t if not defined])],
48 [#include <sys/types.h>
49 #if HAVE_SYS_SOCKET_H
50 # include <sys/socket.h>
51 ]m4_ifdef([gl_SYS_SOCKET_H_DEFAULTS],
52 [#elif HAVE_WS2TCPIP_H
53 # include <ws2tcpip.h>]
54 )[#endif])])
55
56AC_DEFUN([gl_PREREQ_TYPE_SOCKLEN_T],
57 [AC_CHECK_HEADERS_ONCE([sys/socket.h])
58 m4_ifdef([gl_SYS_SOCKET_H_DEFAULTS],
59 [if test $ac_cv_header_sys_socket_h = no; then
60 dnl We cannot use AC_CHECK_HEADERS_ONCE here, because that would make
61 dnl the check for those headers unconditional; yet cygwin reports
62 dnl that the headers are present but cannot be compiled (since on
63 dnl cygwin, all socket information should come from sys/socket.h).
64 AC_CHECK_HEADERS([ws2tcpip.h])
65 fi])])
diff --git a/src/ChangeLog b/src/ChangeLog
index d97969c24db..6eaa52ee285 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,13 @@
12011-03-18 Paul Eggert <eggert@cs.ucla.edu>
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.
7 (Fmake_network_process, server_accept_connection):
8 (wait_reading_process_output, read_process_output):
9 Likewise.
10
12011-03-17 Paul Eggert <eggert@cs.ucla.edu> 112011-03-17 Paul Eggert <eggert@cs.ucla.edu>
2 12
3 Fix more problems found by GCC 4.5.2's static checks. 13 Fix more problems found by GCC 4.5.2's static checks.
diff --git a/src/config.in b/src/config.in
index fbd3ee9338d..8b7312faaaa 100644
--- a/src/config.in
+++ b/src/config.in
@@ -1209,6 +1209,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. */ 1209/* Define to `unsigned int' if <sys/types.h> does not define. */
1210#undef size_t 1210#undef size_t
1211 1211
1212/* type to use in place of socklen_t if not defined */
1213#undef socklen_t
1214
1212/* Define to any substitute for sys_siglist. */ 1215/* Define to any substitute for sys_siglist. */
1213#undef sys_siglist 1216#undef sys_siglist
1214 1217
diff --git a/src/process.c b/src/process.c
index c9b420ab2ae..5a410c1e924 100644
--- a/src/process.c
+++ b/src/process.c
@@ -3467,7 +3467,7 @@ usage: (make-network-process &rest ARGS) */)
3467 if (EQ (service, Qt)) 3467 if (EQ (service, Qt))
3468 { 3468 {
3469 struct sockaddr_in sa1; 3469 struct sockaddr_in sa1;
3470 int len1 = sizeof (sa1); 3470 socklen_t len1 = sizeof (sa1);
3471 if (getsockname (s, (struct sockaddr *)&sa1, &len1) == 0) 3471 if (getsockname (s, (struct sockaddr *)&sa1, &len1) == 0)
3472 { 3472 {
3473 ((struct sockaddr_in *)(lres->ai_addr))->sin_port = sa1.sin_port; 3473 ((struct sockaddr_in *)(lres->ai_addr))->sin_port = sa1.sin_port;
@@ -3514,7 +3514,8 @@ usage: (make-network-process &rest ARGS) */)
3514 /* Unlike most other syscalls connect() cannot be called 3514 /* Unlike most other syscalls connect() cannot be called
3515 again. (That would return EALREADY.) The proper way to 3515 again. (That would return EALREADY.) The proper way to
3516 wait for completion is select(). */ 3516 wait for completion is select(). */
3517 int sc, len; 3517 int sc;
3518 socklen_t len;
3518 SELECT_TYPE fdset; 3519 SELECT_TYPE fdset;
3519 retry_select: 3520 retry_select:
3520 FD_ZERO (&fdset); 3521 FD_ZERO (&fdset);
@@ -3587,7 +3588,7 @@ usage: (make-network-process &rest ARGS) */)
3587 if (!is_server) 3588 if (!is_server)
3588 { 3589 {
3589 struct sockaddr_in sa1; 3590 struct sockaddr_in sa1;
3590 int len1 = sizeof (sa1); 3591 socklen_t len1 = sizeof (sa1);
3591 if (getsockname (s, (struct sockaddr *)&sa1, &len1) == 0) 3592 if (getsockname (s, (struct sockaddr *)&sa1, &len1) == 0)
3592 contact = Fplist_put (contact, QClocal, 3593 contact = Fplist_put (contact, QClocal,
3593 conv_sockaddr_to_lisp ((struct sockaddr *)&sa1, len1)); 3594 conv_sockaddr_to_lisp ((struct sockaddr *)&sa1, len1));
@@ -4192,7 +4193,7 @@ server_accept_connection (Lisp_Object server, int channel)
4192 struct sockaddr_un un; 4193 struct sockaddr_un un;
4193#endif 4194#endif
4194 } saddr; 4195 } saddr;
4195 int len = sizeof saddr; 4196 socklen_t len = sizeof saddr;
4196 4197
4197 s = accept (channel, &saddr.sa, &len); 4198 s = accept (channel, &saddr.sa, &len);
4198 4199
@@ -5059,7 +5060,7 @@ wait_reading_process_output (int time_limit, int microsecs, int read_kbd,
5059 /* getsockopt(,,SO_ERROR,,) is said to hang on some systems. 5060 /* getsockopt(,,SO_ERROR,,) is said to hang on some systems.
5060 So only use it on systems where it is known to work. */ 5061 So only use it on systems where it is known to work. */
5061 { 5062 {
5062 int xlen = sizeof (xerrno); 5063 socklen_t xlen = sizeof (xerrno);
5063 if (getsockopt (channel, SOL_SOCKET, SO_ERROR, &xerrno, &xlen)) 5064 if (getsockopt (channel, SOL_SOCKET, SO_ERROR, &xerrno, &xlen))
5064 xerrno = errno; 5065 xerrno = errno;
5065 } 5066 }
@@ -5171,7 +5172,7 @@ read_process_output (Lisp_Object proc, register int channel)
5171 /* We have a working select, so proc_buffered_char is always -1. */ 5172 /* We have a working select, so proc_buffered_char is always -1. */
5172 if (DATAGRAM_CHAN_P (channel)) 5173 if (DATAGRAM_CHAN_P (channel))
5173 { 5174 {
5174 int len = datagram_address[channel].len; 5175 socklen_t len = datagram_address[channel].len;
5175 nbytes = recvfrom (channel, chars + carryover, readmax, 5176 nbytes = recvfrom (channel, chars + carryover, readmax,
5176 0, datagram_address[channel].sa, &len); 5177 0, datagram_address[channel].sa, &len);
5177 } 5178 }