configure.ac, inet.c, un.c: Portability fixes for 64-bit socketry.
authorMark Wooding <mdw@distorted.org.uk>
Mon, 4 Jun 2018 03:35:29 +0000 (04:35 +0100)
committerMark Wooding <mdw@distorted.org.uk>
Mon, 4 Jun 2018 03:36:29 +0000 (04:36 +0100)
configure.ac
inet.c
un.c

index fac3e56..d625a0c 100644 (file)
@@ -47,6 +47,7 @@ AC_CHECK_HEADERS([unistd.h])
 dnl Types.
 AC_TYPE_UID_T
 AC_TYPE_PID_T
+AX_TYPE_SOCKLEN_T
 
 dnl Declarations.
 AC_CHECK_DECLS([environ])
diff --git a/inet.c b/inet.c
index faa250e..ad93beb 100644 (file)
--- a/inet.c
+++ b/inet.c
@@ -234,7 +234,7 @@ static int srcopt(scanner *sc, addr_opts *ao)
       /* --- Find the netmask, if any --- */
 
       if (sc->t != '/')
-       m.s_addr = ~0ul;
+       m.s_addr = (in_addr_t)~0ul;
       else {
        token(sc);
        DRESET(&d);
@@ -365,7 +365,7 @@ static reffd *inet_accept(int fd, addr_opts *ao, const char *desc)
   inet_srcopts *io = (inet_srcopts *)ao;
   int nfd;
   id_req q;
-  size_t lsinsz = sizeof(q.lsin), rsinsz = sizeof(q.rsin);
+  socklen_t lsinsz = sizeof(q.lsin), rsinsz = sizeof(q.rsin);
   int act = ACL_ALLOW;
 
   /* --- Accept the new connection --- */
diff --git a/un.c b/un.c
index c1e1e4d..1ee5363 100644 (file)
--- a/un.c
+++ b/un.c
@@ -119,7 +119,7 @@ static reffd *un_accept(int fd, addr_opts *ao, const char *desc)
   {
     char buf[PATH_MAX + sizeof(struct sockaddr)];
     struct sockaddr_un *sun = (struct sockaddr_un *)buf;
-    size_t sunsz = sizeof(buf);
+    socklen_t sunsz = sizeof(buf);
 
     if ((nfd = accept(fd, (struct sockaddr *)sun, &sunsz)) < 0)
       return (0);