seccomp: notifier fixes

parent a533ec46
...@@ -351,18 +351,23 @@ int lxc_unix_connect(struct sockaddr_un *addr) ...@@ -351,18 +351,23 @@ int lxc_unix_connect(struct sockaddr_un *addr)
int ret; int ret;
ssize_t len; ssize_t len;
fd = socket(PF_UNIX, SOCK_STREAM, SOCK_CLOEXEC); fd = socket(AF_UNIX, SOCK_STREAM, 0);
if (fd < 0) if (fd < 0) {
SYSERROR("Failed to open new AF_UNIX socket");
return -1; return -1;
}
if (addr->sun_path[0] == '\0') if (addr->sun_path[0] == '\0')
len = strlen(&addr->sun_path[1]); len = strlen(&addr->sun_path[1]);
else else
len = strlen(&addr->sun_path[0]); len = strlen(&addr->sun_path[0]);
ret = connect(fd, (struct sockaddr *)&addr,
offsetof(struct sockaddr_un, sun_path) + len + 1); ret = connect(fd, (struct sockaddr *)addr,
if (ret < 0) offsetof(struct sockaddr_un, sun_path) + len);
if (ret < 0) {
SYSERROR("Failed to bind new AF_UNIX socket");
return -1; return -1;
}
return move_fd(fd); return move_fd(fd);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment