summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChip Salzenberg <chip@perl.com>1997-03-30 15:38:21 +1200
committerChip Salzenberg <chip@atlantic.net>1997-04-01 12:01:35 +1200
commitd574b85ef38b533c29517c911f5b03db91196ab8 (patch)
treedde5247b099e81bb216aa1ad9bb97ce13b1ab8c5
parent22921e25517d6c195d0fab9eb946bfafb563c256 (diff)
downloadperl-d574b85ef38b533c29517c911f5b03db91196ab8.tar.gz
Improve definition of Sock_size_t
-rw-r--r--doio.c16
-rw-r--r--pp_sys.c12
2 files changed, 20 insertions, 8 deletions
diff --git a/doio.c b/doio.c
index 271de285fa..a52df3e784 100644
--- a/doio.c
+++ b/doio.c
@@ -66,6 +66,15 @@
# endif
#endif
+/* Put this after #includes because <unistd.h> defines _XOPEN_*. */
+#ifndef Sock_size_t
+# if _XOPEN_VERSION >= 5 || defined(_XOPEN_SOURCE_EXTENDED)
+# define Sock_size_t Size_t
+# else
+# define Sock_size_t int
+# endif
+#endif
+
bool
do_open(gv,name,len,as_raw,rawmode,rawperm,supplied_fp)
GV *gv;
@@ -288,9 +297,10 @@ PerlIO *supplied_fp;
!statbuf.st_mode
#endif
) {
- int buflen = sizeof tokenbuf;
- if (getsockname(PerlIO_fileno(fp), (struct sockaddr *)tokenbuf, &buflen) >= 0
- || errno != ENOTSOCK)
+ Sock_size_t buflen = sizeof tokenbuf;
+ if (getsockname(PerlIO_fileno(fp), (struct sockaddr *)tokenbuf,
+ &buflen) >= 0
+ || errno != ENOTSOCK)
IoTYPE(io) = 's'; /* some OS's return 0 on fstat()ed socket */
/* but some return 0 for streams too, sigh */
}
diff --git a/pp_sys.c b/pp_sys.c
index 3b06b9ccb1..00012c315d 100644
--- a/pp_sys.c
+++ b/pp_sys.c
@@ -89,11 +89,13 @@ extern int h_errno;
# define vfork fork
#endif
-/* Put this after #includes because <unistd.h> defines _XOPEN_VERSION. */
-#if _XOPEN_VERSION >= 4
-# define Sock_size_t Size_t
-#else
-# define Sock_size_t int
+/* Put this after #includes because <unistd.h> defines _XOPEN_*. */
+#ifndef Sock_size_t
+# if _XOPEN_VERSION >= 5 || defined(_XOPEN_SOURCE_EXTENDED)
+# define Sock_size_t Size_t
+# else
+# define Sock_size_t int
+# endif
#endif
#if !defined(HAS_MKDIR) || !defined(HAS_RMDIR)