diff options
Diffstat (limited to 'src/socket_wrapper.c')
| -rw-r--r-- | src/socket_wrapper.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/socket_wrapper.c b/src/socket_wrapper.c index d352291..fad9475 100644 --- a/src/socket_wrapper.c +++ b/src/socket_wrapper.c @@ -297,6 +297,7 @@ struct swrap_libc_fns { int (*libc_ioctl)(int d, unsigned long int request, ...); int (*libc_listen)(int sockfd, int backlog); int (*libc_open)(const char *pathname, int flags, mode_t mode); + int (*libc_pipe)(int pipefd[2]); int (*libc_read)(int fd, void *buf, size_t count); ssize_t (*libc_readv)(int fd, const struct iovec *iov, int iovcnt); int (*libc_recv)(int sockfd, void *buf, size_t len, int flags); @@ -571,6 +572,13 @@ static int libc_open(const char *pathname, int flags, mode_t mode) return swrap.fns.libc_open(pathname, flags, mode); } +static int libc_pipe(int pipefd[2]) +{ + swrap_load_lib_function(SWRAP_LIBSOCKET, pipe); + + return swrap.fns.libc_pipe(pipefd); +} + static int libc_read(int fd, void *buf, size_t count) { swrap_load_lib_function(SWRAP_LIBC, read); @@ -2068,6 +2076,28 @@ int socket(int family, int type, int protocol) } /**************************************************************************** + * PIPE + ***************************************************************************/ + +static int swrap_pipe(int pipefd[2]) +{ + int rc; + + rc = libc_pipe(pipefd); + if (rc != -1) { + swrap_remove_stale(pipefd[0]); + swrap_remove_stale(pipefd[1]); + } + + return rc; +} + +int pipe(int pipefd[2]) +{ + return swrap_pipe(pipefd); +} + +/**************************************************************************** * ACCEPT ***************************************************************************/ |
