Bug 1376653 - Fix handling of architecture differences for getdents. r?gcp
MozReview-Commit-ID: ArGStWwkJAg
--- a/security/sandbox/linux/SandboxFilterUtil.h
+++ b/security/sandbox/linux/SandboxFilterUtil.h
@@ -100,34 +100,38 @@ public:
#ifdef __NR_stat64
#define CASES_FOR_stat case __NR_stat64
#define CASES_FOR_lstat case __NR_lstat64
#define CASES_FOR_fstat case __NR_fstat64
#define CASES_FOR_fstatat case __NR_fstatat64
#define CASES_FOR_statfs case __NR_statfs64: case __NR_statfs
#define CASES_FOR_fstatfs case __NR_fstatfs64: case __NR_fstatfs
#define CASES_FOR_fcntl case __NR_fcntl64
-// We're using the 32-bit version on 32-bit desktop for some reason.
-#define CASES_FOR_getdents case __NR_getdents64: case __NR_getdents
// FIXME: we might not need the compat cases for these on non-Android:
#define CASES_FOR_lseek case __NR_lseek: case __NR__llseek
#define CASES_FOR_ftruncate case __NR_ftruncate: case __NR_ftruncate64
#else
#define CASES_FOR_stat case __NR_stat
#define CASES_FOR_lstat case __NR_lstat
#define CASES_FOR_fstatat case __NR_newfstatat
#define CASES_FOR_fstat case __NR_fstat
#define CASES_FOR_fstatfs case __NR_fstatfs
#define CASES_FOR_statfs case __NR_statfs
#define CASES_FOR_fcntl case __NR_fcntl
-#define CASES_FOR_getdents case __NR_getdents
#define CASES_FOR_lseek case __NR_lseek
#define CASES_FOR_ftruncate case __NR_ftruncate
#endif
+// getdents is not like the other FS-related syscalls with a "64" variant
+#ifdef __NR_getdents
+#define CASES_FOR_getdents case __NR_getdents64: case __NR_getdents
+#else
+#define CASES_FOR_getdents case __NR_getdents64
+#endif
+
#ifdef __NR_sigprocmask
#define CASES_FOR_sigprocmask case __NR_sigprocmask: case __NR_rt_sigprocmask
#define CASES_FOR_sigaction case __NR_sigaction: case __NR_rt_sigaction
#define CASES_FOR_sigreturn case __NR_sigreturn: case __NR_rt_sigreturn
#else
#define CASES_FOR_sigprocmask case __NR_rt_sigprocmask
#define CASES_FOR_sigaction case __NR_rt_sigaction
#define CASES_FOR_sigreturn case __NR_rt_sigreturn