pulse-server: only unlink sockets

If the entity specified in a unix socket address exists, check
if it is a socket, and bail out if it is not.
This commit is contained in:
Barnabás Pőcze 2021-05-31 17:39:37 +02:00
parent f19d998906
commit 70c6e6ccc8

View file

@ -5971,6 +5971,13 @@ static int start_unix_server(struct server *server, const struct sockaddr_storag
}
}
else if (socket_stat.st_mode & S_IWUSR || socket_stat.st_mode & S_IWGRP) {
if (!S_ISSOCK(socket_stat.st_mode)) {
res = -EEXIST;
pw_log_warn(NAME" %p: '%s' exists and is not a socket",
server, addr_un->sun_path);
goto error_close;
}
/* socket is there, check if it's stale */
if (!is_stale_socket(fd, addr_un)) {
res = -EADDRINUSE;