From 9ea8cc7e99dbce1ef45cae5506fa631842954cc5 Mon Sep 17 00:00:00 2001 From: Pete Delaney Date: Fri, 5 Oct 2012 00:23:50 -0700 Subject: [PATCH] [MIPS] Updated support for statfs and fstatfs. Change-Id: I0d8385cdb6599c572b25abae28498166582b33ca Signed-off-by: Chris Dearman Signed-off-by: Pete Delaney --- .../android/libportable/arch-mips/statfs.c | 21 ++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/ndk/sources/android/libportable/arch-mips/statfs.c b/ndk/sources/android/libportable/arch-mips/statfs.c index cd8b5afac..33ed1c66a 100644 --- a/ndk/sources/android/libportable/arch-mips/statfs.c +++ b/ndk/sources/android/libportable/arch-mips/statfs.c @@ -14,8 +14,11 @@ * limitations under the License. */ -#include #include +#include +#include + +#include static inline void statfs_ntop(struct statfs *n_statfs, struct statfs_portable *p_statfs) { @@ -35,7 +38,13 @@ static inline void statfs_ntop(struct statfs *n_statfs, struct statfs_portable * int statfs_portable(const char* path, struct statfs_portable* stat) { struct statfs mips_stat; - int ret = statfs(path, &mips_stat); + int ret; + + if (invalid_pointer(stat)) { + errno = EFAULT; + return -1; + } + ret = statfs(path, &mips_stat); statfs_ntop(&mips_stat, stat); return ret; } @@ -43,7 +52,13 @@ int statfs_portable(const char* path, struct statfs_portable* stat) int fstatfs_portable(int fd, struct statfs_portable* stat) { struct statfs mips_stat; - int ret = fstatfs(fd, &mips_stat); + int ret; + + if (invalid_pointer(stat)) { + errno = EFAULT; + return -1; + } + ret = fstatfs(fd, &mips_stat); statfs_ntop(&mips_stat, stat); return ret; }