From 1d34dd0c275c37cbf5d470e80b52fffc4375d6cf Mon Sep 17 00:00:00 2001 From: Chao-Ying Fu Date: Mon, 20 Aug 2012 17:07:27 -0700 Subject: [PATCH] Fix flags to *_PORTABLE in open_portable(), and support openat_portable(). Change-Id: Ib889899250fdfc6e7caded2506228f640fcdff3a --- .../android/libportable/arch-mips/open.c | 23 +++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/ndk/sources/android/libportable/arch-mips/open.c b/ndk/sources/android/libportable/arch-mips/open.c index 384b89458..2f4dcd7de 100644 --- a/ndk/sources/android/libportable/arch-mips/open.c +++ b/ndk/sources/android/libportable/arch-mips/open.c @@ -63,9 +63,9 @@ extern int __open(const char*, int, int); int open_portable(const char *pathname, int flags, ...) { mode_t mode = 0; - flags |= O_LARGEFILE; + flags |= O_LARGEFILE_PORTABLE; - if (flags & O_CREAT) + if (flags & O_CREAT_PORTABLE) { va_list args; @@ -76,3 +76,22 @@ int open_portable(const char *pathname, int flags, ...) return __open(pathname, mips_change_flags(flags), mode); } + +extern int __openat(int, const char*, int, int); +int openat_portable(int fd, const char *pathname, int flags, ...) +{ + mode_t mode = 0; + + flags |= O_LARGEFILE_PORTABLE; + + if (flags & O_CREAT_PORTABLE) + { + va_list args; + + va_start(args, flags); + mode = (mode_t) va_arg(args, int); + va_end(args); + } + + return __openat(fd, pathname, mips_change_flags(flags), mode); +}