diff options
author | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2020-01-04 07:20:35 +0200 |
---|---|---|
committer | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2020-01-04 16:07:17 +0200 |
commit | abce49655af00e2cfbdfba8cdf2a68d68345f2a1 (patch) | |
tree | 30fa841cd03cc967109da3e0cf859c14efeb1554 | |
parent | 0ce8f2390b5280887a2ac179faf2aa01604cb1cc (diff) |
v4l2: Fix compilation of __open_2() and __openat_2() with gcc
The __open_2() and __openat_2() functions are defined by glibc as taking
2 and 3 arguments respectively, with variadic arguments for the file
mode as open() and openat() do. The V4L2 compatibility layer defines
them as aliases for open() and openat(), which results in compilation
failures with gcc:
../../src/v4l2/v4l2_compat.cpp: In function ‘int __openat_2(int, const char*, int)’:
../../src/v4l2/v4l2_compat.cpp:58:14: error: invalid conversion from ‘int’ to ‘const char*’ [-fpermissive]
58 | return open(dirfd, path, oflag);
| ^~~~~
| |
| int
../../src/v4l2/v4l2_compat.cpp:31:39: note: initializing argument 1 of ‘int open(const char*, int, ...)’
31 | LIBCAMERA_PUBLIC int open(const char *path, int oflag, ...)
| ~~~~~~~~~~~~^~~~
../../src/v4l2/v4l2_compat.cpp:58:21: error: invalid conversion from ‘const char*’ to ‘int’ [-fpermissive]
58 | return open(dirfd, path, oflag);
| ^~~~
| |
| const char*
../../src/v4l2/v4l2_compat.cpp:31:49: note: initializing argument 2 of ‘int open(const char*, int, ...)’
31 | LIBCAMERA_PUBLIC int open(const char *path, int oflag, ...)
|
Fix this by defining the two functions as wrappers around open() and
openat() without variadic arguments.
Fixes: 0ce8f2390b52 ("v4l2: v4l2_compat: Add V4L2 compatibility layer")
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
-rw-r--r-- | src/v4l2/v4l2_compat.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/v4l2/v4l2_compat.cpp b/src/v4l2/v4l2_compat.cpp index 171ebed6..a162037f 100644 --- a/src/v4l2/v4l2_compat.cpp +++ b/src/v4l2/v4l2_compat.cpp @@ -39,7 +39,10 @@ LIBCAMERA_PUBLIC int open(const char *path, int oflag, ...) } /* _FORTIFY_SOURCE redirects open to __open_2 */ -LIBCAMERA_PUBLIC extern __typeof(open) __open_2 __attribute__ ((alias("open"))); +LIBCAMERA_PUBLIC int __open_2(const char *path, int oflag) +{ + return open(path, oflag); +} LIBCAMERA_PUBLIC int openat(int dirfd, const char *path, int oflag, ...) { @@ -50,7 +53,10 @@ LIBCAMERA_PUBLIC int openat(int dirfd, const char *path, int oflag, ...) return V4L2CompatManager::instance()->openat(dirfd, path, oflag, mode); } -LIBCAMERA_PUBLIC extern __typeof(openat) __openat_2 __attribute__ ((alias("openat"))); +LIBCAMERA_PUBLIC int __openat_2(int dirfd, const char *path, int oflag) +{ + return openat(dirfd, path, oflag); +} LIBCAMERA_PUBLIC int dup(int oldfd) { |