tests: Fix fake socket_wrapper_syscall_valid()
[uid_wrapper.git] / tests / uwrap_fake_socket_wrapper.c
1 #include "config.h"
2
3 #include <stdarg.h>
4 #include <stddef.h>
5 #include <setjmp.h>
6 #include <cmocka.h>
7
8 #include <stdbool.h>
9 #include <string.h>
10 #include <sys/time.h>
11 #include <unistd.h>
12 #include <errno.h>
13
14 #ifdef HAVE_SYS_SYSCALL_H
15 #include <sys/syscall.h>
16 #endif
17 #ifdef HAVE_SYSCALL_H
18 #include <syscall.h>
19 #endif
20
21 #include "uwrap_fake_socket_wrapper.h"
22
23 /* simulate socket_wrapper hooks */
24 bool socket_wrapper_syscall_valid(long int sysno)
25 {
26         if (sysno >= __FAKE_SOCKET_WRAPPER_SYSCALL_NO) {
27                 return true;
28         }
29
30         return false;
31 }
32
33 long int socket_wrapper_syscall_va(long int sysno, va_list va)
34 {
35         (void) va; /* unused */
36
37         if (sysno == __FAKE_SOCKET_WRAPPER_SYSCALL_NO) {
38                 errno = 0;
39                 return __FAKE_SOCKET_WRAPPER_SYSCALL_RC;
40         }
41
42         errno = ENOSYS;
43         return -1;
44 }