tap: Support for detection of existing sockets on ramfs
On ramfs, connecting to a non-existent UNIX domain socket yields EACCESS, instead of ENOENT. This is visible if we use passt directly on rootfs (a ramfs instance) from an initramfs image. It's probably wrong for ramfs to return EACCES, but given the simplicity of the filesystem, I doubt we should try to fix it there at the possible cost of added complexity. Also, this whole beauty should go away once qrap-less usage is established, so just accept EACCES as indication that a conflicting socket does not, in fact, exist. Signed-off-by: Stefano Brivio <sbrivio@redhat.com> Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
This commit is contained in:
parent
e76e65a36e
commit
2d4468ebb7
1 changed files with 2 additions and 1 deletions
3
tap.c
3
tap.c
|
@ -912,7 +912,8 @@ static void tap_sock_unix_init(struct ctx *c)
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = connect(ex, (const struct sockaddr *)&addr, sizeof(addr));
|
ret = connect(ex, (const struct sockaddr *)&addr, sizeof(addr));
|
||||||
if (!ret || (errno != ENOENT && errno != ECONNREFUSED)) {
|
if (!ret || (errno != ENOENT && errno != ECONNREFUSED &&
|
||||||
|
errno != EACCES)) {
|
||||||
if (*c->sock_path) {
|
if (*c->sock_path) {
|
||||||
err("Socket path %s already in use", path);
|
err("Socket path %s already in use", path);
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
|
|
Loading…
Reference in a new issue