From 510315a96a9f72064d55a3cadde7c5d3ba14d394 Mon Sep 17 00:00:00 2001 From: Thibault Godouet Date: Mon, 26 Nov 2012 20:31:30 +0000 Subject: [PATCH] More portable code for va_arg() with mode_t (thank you Chris Calvey) (followed recommendation from http://www.gnu.org/software/gnulib/manual/html_node/va_005farg.html) --- subs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/subs.c b/subs.c index 204e5f5..25ce697 100644 --- a/subs.c +++ b/subs.c @@ -102,7 +102,7 @@ open_as_user(const char *pathname, uid_t openuid, gid_t opengid, int flags, ...) if (flags & O_CREAT) { va_start(ap, flags); - mode = va_arg(ap, mode_t); + mode = (sizeof(mode_t) < sizeof(int)) ? va_arg(ap, int) : va_arg(ap, mode_t); va_end(ap); } @@ -160,7 +160,7 @@ open_as_user(const char *pathname, uid_t openuid, gid_t opengid, int flags, ...) if (flags & O_CREAT) { va_start(ap, flags); - mode = va_arg(ap, mode_t); + mode = (sizeof(mode_t) < sizeof(int)) ? va_arg(ap, int) : va_arg(ap, mode_t); va_end(ap); } -- 2.40.0