mirror of
https://git.proxmox.com/git/mirror_lxc
synced 2025-07-24 13:43:31 +00:00
af_unix: make sure to keep useful errno
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
This commit is contained in:
parent
65a2d6b2ba
commit
dba104c82e
@ -56,12 +56,16 @@ int lxc_af_unix_open(const char *path, int type, int flags)
|
||||
path[0]?strlen(path):sizeof(addr.sun_path));
|
||||
|
||||
if (bind(fd, (struct sockaddr *)&addr, sizeof(addr))) {
|
||||
int tmp = errno;
|
||||
close(fd);
|
||||
errno = tmp;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (type == SOCK_STREAM && listen(fd, 100)) {
|
||||
int tmp = errno;
|
||||
close(fd);
|
||||
errno = tmp;
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -99,7 +103,9 @@ int lxc_af_unix_connect(const char *path)
|
||||
path[0]?strlen(path):sizeof(addr.sun_path));
|
||||
|
||||
if (connect(fd, (struct sockaddr *)&addr, sizeof(addr))) {
|
||||
int tmp = errno;
|
||||
close(fd);
|
||||
errno = tmp;
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user