Resolve linker issues with Android API 21 (dprintf, tcdrain)
authorChris Renshaw <osm0sis@outlook.com>
Thu, 17 Dec 2015 15:42:01 +0000 (16:42 +0100)
committerDenys Vlasenko <vda.linux@googlemail.com>
Thu, 17 Dec 2015 15:42:41 +0000 (16:42 +0100)
Signed-off-by: Chris Renshaw <osm0sis@outlook.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
include/platform.h
libbb/missing_syscalls.c

index 1706b1847fc518d24906bc3e583f171e9d4c69d8..026ebbe174219f5033bd4a761cf470c534ac5cea 100644 (file)
@@ -481,9 +481,14 @@ typedef unsigned smalluint;
 
 #if defined(ANDROID) || defined(__ANDROID__)
 # if __ANDROID_API__ < 8
+   /* ANDROID < 8 has no [f]dprintf at all */
 #  undef HAVE_DPRINTF
-# else
+# elif __ANDROID_API__ < 21
+   /* ANDROID < 21 has fdprintf */
 #  define dprintf fdprintf
+# else
+   /* ANDROID >= 21 has standard dprintf */
+# endif
 # endif
 # if __ANDROID_API__ < 21
 #  undef HAVE_TTYNAME_R
index e3c1e924bcb709cfd1f945114ef0a5da19e884bf..0934128117a6a8999e8749050be1974d229abda7 100644 (file)
@@ -40,8 +40,10 @@ int pivot_root(const char *new_root, const char *put_old)
        return syscall(__NR_pivot_root, new_root, put_old);
 }
 
+# if __ANDROID_API__ < 21
 int tcdrain(int fd)
 {
        return ioctl(fd, TCSBRK, 1);
 }
+# endif
 #endif