diff options
author | Andreas Schneider <asn@samba.org> | 2014-01-28 10:33:36 +0100 |
---|---|---|
committer | Andreas Schneider <asn@samba.org> | 2014-01-28 13:25:14 +0100 |
commit | 5acfcfea50ce2dd1b0388c33c849ce19007cf77b (patch) | |
tree | 39b95bbbc37ed4012cdcc4a363c209a4da27640e | |
parent | 05cb607f08321b1680e51cb3bb33222922f46401 (diff) | |
download | socket_wrapper-5acfcfea50ce2dd1b0388c33c849ce19007cf77b.tar.gz socket_wrapper-5acfcfea50ce2dd1b0388c33c849ce19007cf77b.tar.xz socket_wrapper-5acfcfea50ce2dd1b0388c33c849ce19007cf77b.zip |
src: Check for stale fds in swrap_socket().
Reviewed-by: Stefan Metzmacher <metze@samba.org>
-rw-r--r-- | src/socket_wrapper.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/socket_wrapper.c b/src/socket_wrapper.c index 955b6ad..d7525f8 100644 --- a/src/socket_wrapper.c +++ b/src/socket_wrapper.c @@ -2023,7 +2023,15 @@ static int swrap_socket(int family, int type, int protocol) */ fd = libc_socket(AF_UNIX, type, 0); - if (fd == -1) return -1; + if (fd == -1) { + return -1; + } + + /* Check if we have a stale fd and remove it */ + si = find_socket_info(fd); + if (si != NULL) { + swrap_remove_stale(fd); + } si = (struct socket_info *)malloc(sizeof(struct socket_info)); memset(si, 0, sizeof(struct socket_info)); |