Merge pull request #267 from hdornemann/master

fix for dup2 on windows
libnfs-4.0.0-vitalif
Ronnie Sahlberg 2018-09-14 14:40:30 +10:00 committed by GitHub
commit 273182748d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 0 deletions

View File

@ -591,11 +591,18 @@ rpc_connect_sockaddr_async(struct rpc_context *rpc)
}
if (rpc->old_fd) {
#if !defined(WIN32)
if (dup2(rpc->fd, rpc->old_fd) == -1) {
return -1;
}
close(rpc->fd);
rpc->fd = rpc->old_fd;
#else
/* On Windows dup2 does not work on sockets
* instead just close the old socket */
close(rpc->old_fd);
rpc->old_fd = 0;
#endif
}
/* Some systems allow you to set capabilities on an executable