diff --git a/include/platform.h b/include/platform.h index ce868d6a6..9e9ffa782 100644 --- a/include/platform.h +++ b/include/platform.h @@ -412,6 +412,8 @@ typedef unsigned smalluint; #define HAVE_NET_ETHERNET_H 1 #define HAVE_SYS_STATFS_H 1 #define HAVE_PRINTF_PERCENTM 1 +#define HAVE_WAIT3 1 +#define HAVE_ISSETUGID 1 #if defined(__UCLIBC__) # if UCLIBC_VERSION < KERNEL_VERSION(0, 9, 32) @@ -516,10 +518,15 @@ typedef unsigned smalluint; # else /* ANDROID >= 21 has standard dprintf */ # endif +# if __ANDROID_API__ > 18 +# undef HAVE_ISSETUGID +# endif # if __ANDROID_API__ < 21 # undef HAVE_TTYNAME_R # undef HAVE_GETLINE # undef HAVE_STPCPY +# else +# undef HAVE_WAIT3 # endif # undef HAVE_MEMPCPY # undef HAVE_STRCHRNUL @@ -608,4 +615,14 @@ extern int vasprintf(char **string_ptr, const char *format, va_list p) FAST_FUNC extern ssize_t getline(char **lineptr, size_t *n, FILE *stream) FAST_FUNC; #endif +#ifndef HAVE_WAIT3 +/* Wrap wait3() to wait4() for libc implementations without (e.g. Bionic on ANDROID >= 21) */ +# include /* for rusage */ +static pid_t wait3(int* status, int options, struct rusage* rusage) { return wait4(-1, status, options, rusage); } +#endif + +#ifndef HAVE_ISSETUGID +extern int issetugid(void) FAST_FUNC; +#endif + #endif diff --git a/libbb/platform.c b/libbb/platform.c index 03bbb798b..a5b60074a 100644 --- a/libbb/platform.c +++ b/libbb/platform.c @@ -213,3 +213,11 @@ int ttyname_r(int fd, char *buf, size_t buflen) return 0; } #endif + +#ifndef HAVE_ISSETUGID +int issetugid(void) +{ + /* for Bionic, this is sufficient */ + return 0; +} +#endif