]> git.proxmox.com Git - mirror_lxc.git/blobdiff - src/lxc/af_unix.c
Merge pull request #2964 from tomponline/tp-l2proxy
[mirror_lxc.git] / src / lxc / af_unix.c
index 275430a52a2a0e5347a895784dc31517927bdb07..9e2f8587c8364b86558ef1fbe919f352f2130f1e 100644 (file)
@@ -199,6 +199,12 @@ again:
        return ret;
 }
 
+int lxc_unix_send_fds(int fd, int *sendfds, int num_sendfds, void *data,
+                     size_t size)
+{
+       return lxc_abstract_unix_send_fds(fd, sendfds, num_sendfds, data, size);
+}
+
 int lxc_abstract_unix_recv_fds(int fd, int *recvfds, int num_recvfds,
                               void *data, size_t size)
 {
@@ -365,18 +371,23 @@ int lxc_unix_connect(struct sockaddr_un *addr)
        int ret;
        ssize_t len;
 
-       fd = socket(PF_UNIX, SOCK_STREAM, SOCK_CLOEXEC);
-       if (fd < 0)
+       fd = socket(AF_UNIX, SOCK_STREAM, 0);
+       if (fd < 0) {
+               SYSERROR("Failed to open new AF_UNIX socket");
                return -1;
+       }
 
        if (addr->sun_path[0] == '\0')
                len = strlen(&addr->sun_path[1]);
        else
                len = strlen(&addr->sun_path[0]);
-       ret = connect(fd, (struct sockaddr *)&addr,
-                     offsetof(struct sockaddr_un, sun_path) + len + 1);
-       if (ret < 0)
+
+       ret = connect(fd, (struct sockaddr *)addr,
+                     offsetof(struct sockaddr_un, sun_path) + len);
+       if (ret < 0) {
+               SYSERROR("Failed to bind new AF_UNIX socket");
                return -1;
+       }
 
        return move_fd(fd);
 }