preload-hacks: Some patches to make it work. master
authorMark Wooding <mdw@distorted.org.uk>
Tue, 12 Jun 2018 11:25:21 +0000 (12:25 +0100)
committerMark Wooding <mdw@distorted.org.uk>
Tue, 12 Jun 2018 11:25:21 +0000 (12:25 +0100)
The `SUN_LEN' patch is upstream and can be removed later.  The `ioctl'
patch is because Android is gratuitously different here.

packages/preload-hacks/build.sh
packages/preload-hacks/ioctl.patch [new file with mode: 0644]
packages/preload-hacks/sun-len.patch [new file with mode: 0644]

index de69cc1..6177aa4 100644 (file)
@@ -10,3 +10,5 @@ TERMUX_PKG_SHA256=479f1d823dd07f0a57741852bc1d3ae3d5e8f3350e1dcb17f0e6bab3e0ebd3
 TERMUX_PKG_SRCURL="http://ftp.distorted.org.uk/u/mdw/preload-hacks-$TERMUX_PKG_VERSION.tar.gz"
 
 TERMUX_PKG_CLANG=no
+CC=$TERMUX_HOST_PLATFORM-gcc
+TERMUX_PKG_EXTRA_CONFIGURE_ARGS="--CC=$CC --LD=$CC"
diff --git a/packages/preload-hacks/ioctl.patch b/packages/preload-hacks/ioctl.patch
new file mode 100644 (file)
index 0000000..a5aadce
--- /dev/null
@@ -0,0 +1,22 @@
+diff --git a/noip.c b/noip.c
+index aca7b75..072d2fc 100644
+--- a/noip.c
++++ b/noip.c
+@@ -149,7 +152,7 @@ static impbind *impbinds, **impbind_tail = &impbinds;
+                       struct sockaddr *from, socklen_t *fromlen))     \
+   _(sendmsg, ssize_t, (int, const struct msghdr *, int))              \
+   _(recvmsg, ssize_t, (int, struct msghdr *, int))                    \
+-  _(ioctl, int, (int, unsigned long, ...))
++  _(ioctl, int, (int, int, ...))
+ /* Function pointers to set up. */
+ #define DECL(imp, ret, args) static ret (*real_##imp) args;
+@@ -2000,7 +2003,7 @@ int setsockopt(int sk, int lev, int opt, const void *p, socklen_t len)
+   return (real_setsockopt(sk, lev, opt, p, len));
+ }
+-int ioctl(int fd, unsigned long op, ...)
++int ioctl(int fd, int op, ...)
+ {
+   va_list ap;
+   void *arg;
diff --git a/packages/preload-hacks/sun-len.patch b/packages/preload-hacks/sun-len.patch
new file mode 100644 (file)
index 0000000..143dabe
--- /dev/null
@@ -0,0 +1,32 @@
+diff --git a/noip.c b/noip.c
+index aca7b75..479bdf5 100644
+--- a/noip.c
++++ b/noip.c
+@@ -57,6 +57,11 @@
+ #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 3c0d1d4..22b09db 100644
+--- a/uopen.c
++++ b/uopen.c
+@@ -42,6 +42,11 @@
+ #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. */