$NetBSD: patch-am,v 1.2 2010/12/27 04:58:10 obache Exp $

* XXXX
* `mode_t' is promoted to `int' when passed through `...'.

--- libv4l1/v4l1compat.c.orig	2008-08-26 12:32:39.000000000 +0000
+++ libv4l1/v4l1compat.c
@@ -40,6 +40,10 @@
 #define LIBV4L_PUBLIC
 #endif
 
+#ifndef O_LARGEFILE
+#define O_LARGEFILE 0
+#endif
+
 LIBV4L_PUBLIC int open (const char *file, int oflag, ...)
 {
   int fd;
@@ -50,7 +54,7 @@ LIBV4L_PUBLIC int open (const char *file
     mode_t mode;
 
     va_start (ap, oflag);
-    mode = va_arg (ap, mode_t);
+    mode = (sizeof (mode_t) < sizeof (int) ? (mode_t)va_arg (ap, int) : va_arg (ap, mode_t));
 
     fd = v4l1_open(file, oflag, mode);
 
@@ -71,7 +75,7 @@ LIBV4L_PUBLIC int open64 (const char *fi
     mode_t mode;
 
     va_start (ap, oflag);
-    mode = va_arg (ap, mode_t);
+    mode = (mode_t)va_arg (ap, int);
 
     fd = v4l1_open(file, oflag | O_LARGEFILE, mode);
 
