From: Sean Hefty Date: Mon, 30 Jul 2012 23:06:32 +0000 (-0700) Subject: rspreload: Support dup2 calls X-Git-Url: https://openfabrics.org/gitweb/?a=commitdiff_plain;h=810924b05f1448e9da2916d16c71a44996ade3dc;p=~shefty%2Flibrdmacm.git rspreload: Support dup2 calls vsftpd requires dup2() support. To handle dup2, we need to add reference count tracking to the preload fd's. Signed-off-by: Sean Hefty --- diff --git a/src/preload.c b/src/preload.c index a6801434..4b891a10 100644 --- a/src/preload.c +++ b/src/preload.c @@ -886,3 +886,10 @@ int fcntl(int socket, int cmd, ... /* arg */) va_end(args); return ret; } + +int dup2(int oldfd, int newfd) +{ + int fd; + return (fd_get(oldfd, &fd) == fd_rsocket) ? + : dup2(oldfd, newfd); +}