[PATCH] fix time+hush: add missing definitions on Android API 21+

This commit is contained in:
topjohnwu 2018-05-19 11:05:27 +08:00
parent f40eafd0d8
commit 801f10ed97
2 changed files with 25 additions and 0 deletions

View File

@ -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 <sys/wait.h> /* 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

View File

@ -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