]> git.openfabrics.org - ~shefty/librdmacm.git/commitdiff
rspreload: Support dup2 calls
authorSean Hefty <sean.hefty@intel.com>
Mon, 30 Jul 2012 23:06:32 +0000 (16:06 -0700)
committerSean Hefty <sean.hefty@intel.com>
Wed, 1 Aug 2012 23:28:23 +0000 (16:28 -0700)
vsftpd requires dup2() support.  To handle dup2, we need to add
reference count tracking to the preload fd's.

Signed-off-by: Sean Hefty <sean.hefty@intel.com>
src/preload.c

index a6801434688902131903fe4d49d9226c34e52692..4b891a10e2ecb6b920359dd813262beaae571568 100644 (file)
@@ -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);
+}