Skip to content

Commit 46f93d4

Browse files
committed
adapter/syscall: fix ioctl conflicting types compile error (#942)
1 parent b36ce99 commit 46f93d4

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

adapter/syscall/ff_hook_syscall.c

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#include <assert.h>
22
#include <dlfcn.h>
33
#include <unistd.h>
4+
#include <stdarg.h>
45
#include <sys/epoll.h>
56
#include <sys/resource.h>
67
#include <errno.h>
@@ -1882,6 +1883,25 @@ ff_hook_ioctl(int fd, unsigned long req, unsigned long data)
18821883
RETURN_NOFREE();
18831884
}
18841885

1886+
/*
1887+
* Public ioctl() entry point with variadic signature matching glibc's
1888+
* declaration: int ioctl(int fd, unsigned long request, ...)
1889+
* This avoids the 'conflicting types' compile error when strong_alias is
1890+
* used against the fixed-arg ff_hook_ioctl prototype (issue #942).
1891+
*/
1892+
int
1893+
ioctl(int fd, unsigned long req, ...)
1894+
{
1895+
va_list ap;
1896+
unsigned long data;
1897+
1898+
va_start(ap, req);
1899+
data = va_arg(ap, unsigned long);
1900+
va_end(ap);
1901+
1902+
return ff_hook_ioctl(fd, req, data);
1903+
}
1904+
18851905
int
18861906
ff_hook_fcntl(int fd, int cmd, unsigned long data)
18871907
{

0 commit comments

Comments
 (0)