safe_open: fix SIGILL on android
in safe_macros.c's safe_open:
warning: 'mode_t' is promoted to 'int' when passed through '...'
mode = va_arg(ap, mode_t);
^
note: so you should pass 'int' not 'mode_t' to 'va_arg')
note: if this code is reached, the program will abort
Signed-off-by: Steven Jackson <sj@oscode.net>
Acked-by: Cyril Hrubis <chrubis@suse.cz>
diff --git a/lib/safe_macros.c b/lib/safe_macros.c
index 094e5c7..d696a0b 100644
--- a/lib/safe_macros.c
+++ b/lib/safe_macros.c
@@ -210,7 +210,12 @@
mode_t mode;
va_start(ap, oflags);
- mode = va_arg(ap, mode_t);
+
+ /* Android's NDK's mode_t is smaller than an int, which results in
+ * SIGILL here when passing the mode_t type.
+ */
+ mode = va_arg(ap, int);
+
va_end(ap);
rval = open(pathname, oflags, mode);