mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-02 09:01:50 -05:00
pulse-server: set the right error when socket is busy
This commit is contained in:
parent
5ebb95a346
commit
34cc13a60c
1 changed files with 6 additions and 8 deletions
|
|
@ -4471,18 +4471,16 @@ static int make_local_socket(struct server *server, char *name)
|
||||||
goto error_close;
|
goto error_close;
|
||||||
}
|
}
|
||||||
} else if (socket_stat.st_mode & S_IWUSR || socket_stat.st_mode & S_IWGRP) {
|
} else if (socket_stat.st_mode & S_IWUSR || socket_stat.st_mode & S_IWGRP) {
|
||||||
/* socket is there, check if we can connect */
|
/* socket is there, check if it's stale */
|
||||||
if (is_stale_socket(server, fd)) {
|
if (!is_stale_socket(server, fd)) {
|
||||||
/* we can't connect, probably stale, remove it */
|
res = -EBUSY;
|
||||||
pw_log_warn(NAME" %p: unlink stale socket %s: %s", server,
|
|
||||||
server->addr.sun_path, spa_strerror(res));
|
|
||||||
unlink(server->addr.sun_path);
|
|
||||||
} else {
|
|
||||||
/* we could connect so it's probably in use */
|
|
||||||
pw_log_info(NAME" %p: socket %s is in use", server,
|
pw_log_info(NAME" %p: socket %s is in use", server,
|
||||||
server->addr.sun_path);
|
server->addr.sun_path);
|
||||||
goto error_close;
|
goto error_close;
|
||||||
}
|
}
|
||||||
|
pw_log_warn(NAME" %p: unlink stale socket %s: %s", server,
|
||||||
|
server->addr.sun_path, spa_strerror(res));
|
||||||
|
unlink(server->addr.sun_path);
|
||||||
}
|
}
|
||||||
if (bind(fd, (struct sockaddr *) &server->addr, size) < 0) {
|
if (bind(fd, (struct sockaddr *) &server->addr, size) < 0) {
|
||||||
res = -errno;
|
res = -errno;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue