diff options
author | Andreas Schneider <asn@samba.org> | 2014-10-02 07:16:25 +0200 |
---|---|---|
committer | Andreas Schneider <asn@cryptomilk.org> | 2014-10-02 09:35:10 +0200 |
commit | 4402ba10b5afc57e72b45ce640c14764d5f0f2c7 (patch) | |
tree | 977424786ec0e926097fa88d1c7859b3c112d9e7 /lib/socket_wrapper/socket_wrapper.c | |
parent | 9da1ff9ad1d7983bd11693263f3dfcd1ed9685d4 (diff) | |
download | samba-4402ba10b5afc57e72b45ce640c14764d5f0f2c7.tar.gz samba-4402ba10b5afc57e72b45ce640c14764d5f0f2c7.tar.xz samba-4402ba10b5afc57e72b45ce640c14764d5f0f2c7.zip |
swrap: Use a sockaddr_un for the unix path in socket_info.
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Diffstat (limited to 'lib/socket_wrapper/socket_wrapper.c')
-rw-r--r-- | lib/socket_wrapper/socket_wrapper.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/lib/socket_wrapper/socket_wrapper.c b/lib/socket_wrapper/socket_wrapper.c index b6f86ebbcf..b5c5b4671a 100644 --- a/lib/socket_wrapper/socket_wrapper.c +++ b/lib/socket_wrapper/socket_wrapper.c @@ -242,7 +242,8 @@ struct socket_info int defer_connect; int pktinfo; - char *tmp_path; + /* The unix path so we can unlink it on close() */ + struct sockaddr_un un_addr; struct sockaddr *bindname; socklen_t bindname_len; @@ -2739,7 +2740,8 @@ static int swrap_auto_bind(int fd, struct socket_info *si, int family) ret = libc_bind(fd, &un_addr.sa.s, un_addr.sa_socklen); if (ret == -1) return ret; - si->tmp_path = strdup(un_addr.sa.un.sun_path); + si->un_addr = un_addr.sa.un; + si->bound = 1; autobind_start = port + 1; break; @@ -4789,9 +4791,9 @@ static int swrap_close(int fd) if (si->myname) free(si->myname); if (si->peername) free(si->peername); - if (si->tmp_path) { - unlink(si->tmp_path); - free(si->tmp_path); + + if (si->un_addr.sun_path[0] != '\0') { + unlink(si->un_addr.sun_path); } free(si); |