};
struct socket_info *si = find_socket_info(s);
struct swrap_sockaddr_buf buf = {};
+ int ret_errno = errno;
int bind_error = 0;
#if 0 /* FIXME */
bool in_use;
}
if (bind_error != 0) {
- errno = bind_error;
+ ret_errno = bind_error;
ret = -1;
goto out;
}
1,
&si->bcast);
if (ret == -1) {
+ ret_errno = errno;
goto out;
}
unlink(un_addr.sa.un.sun_path);
ret = libc_bind(s, &un_addr.sa.s, un_addr.sa_socklen);
+ if (ret == -1) {
+ ret_errno = errno;
+ }
SWRAP_LOG(SWRAP_LOG_TRACE,
- "bind(%s) path=%s, fd=%d",
+ "bind(%s) path=%s, fd=%d ret=%d ret_errno=%d",
swrap_sockaddr_string(&buf, myaddr),
- un_addr.sa.un.sun_path, s);
+ un_addr.sa.un.sun_path, s, ret, ret_errno);
if (ret == 0) {
si->bound = 1;
out:
SWRAP_UNLOCK_SI(si);
-
+ errno = ret_errno;
return ret;
}