chiark / gitweb /
noip.c, uopen.c: Provide fallback implementation of `SUN_LEN'.
authorMark Wooding <mdw@distorted.org.uk>
Tue, 12 Jun 2018 11:07:34 +0000 (12:07 +0100)
committerMark Wooding <mdw@distorted.org.uk>
Tue, 12 Jun 2018 11:07:34 +0000 (12:07 +0100)
Apparently Android's `libc' doesn't have this.

noip.c
uopen.c

diff --git a/noip.c b/noip.c
index aca7b75e7d4e907b99e748d03a27b38d39a64d1a..b9c040b21025a7ed1035fe3bf610c45a70360316 100644 (file)
--- a/noip.c
+++ b/noip.c
 #include <ifaddrs.h>
 #include <netdb.h>
 
+#ifndef SUN_LEN
+#  define SUN_LEN (sun) \
+       (strlen((sun)->sun_path) + offsetof(struct sockaddr_un, sun_path))
+#endif
+
 /*----- Data structures ---------------------------------------------------*/
 
 /* Unix socket status values. */
diff --git a/uopen.c b/uopen.c
index 3c0d1d41717c5a23a21b14ae82b9d49013289fa5..22b09db5a15cc5cd6eec8cee11ed9c5f13750ddb 100644 (file)
--- a/uopen.c
+++ b/uopen.c
 #include <sys/stat.h>
 #include <sys/un.h>
 
+#ifndef SUN_LEN
+#  define SUN_LEN (sun) \
+       (strlen((sun)->sun_path) + offsetof(struct sockaddr_un, sun_path))
+#endif
+
 /*----- Import the real versions of functions -----------------------------*/
 
 /* The list of functions to immport. */