summaryrefslogtreecommitdiff
path: root/main/cvs/cvs-1.12.12-openat.patch
blob: fdb406a45e4fe09bf5837b578c09a03401fe45ec (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
Index: cvs-1.12.12/lib/openat.c
===================================================================
--- cvs-1.12.12.orig/lib/openat.c
+++ cvs-1.12.12/lib/openat.c
@@ -55,9 +55,13 @@ rpl_openat (int fd, char const *filename
       va_list arg;
       va_start (arg, flags);
 
-      /* Assume that mode_t is passed compatibly with mode_t's type
-	 after argument promotion.  */
-      mode = va_arg (arg, mode_t);
+      /* If mode_t is narrower than int, use the promoted type (int),
+         not mode_t.  Use sizeof to guess whether mode_t is nerrower;
+         we don't know of any practical counterexamples.  */
+      if (sizeof (mode_t) < sizeof (int))
+	mode = va_arg (arg, int);
+      else
+	mode = va_arg (arg, mode_t);
 
       va_end (arg);
     }