socket-netlink: use stat_verify_socket() more

This commit is contained in:
Lennart Poettering
2026-04-13 13:20:43 +02:00
parent 4031a73a4b
commit 4eb60e3160
+4 -2
View File
@@ -18,6 +18,7 @@
#include "socket-label.h"
#include "socket-netlink.h"
#include "socket-util.h"
#include "stat-util.h"
#include "string-util.h"
int socket_address_parse(SocketAddress *a, const char *s) {
@@ -497,8 +498,9 @@ int af_unix_get_qlen(int fd, uint32_t *ret) {
struct stat st;
if (fstat(fd, &st) < 0)
return -errno;
if (!S_ISSOCK(st.st_mode))
return -ENOTSOCK;
r = stat_verify_socket(&st);
if (r < 0)
return r;
_cleanup_(sd_netlink_unrefp) sd_netlink *nl = NULL;
r = sd_sock_diag_socket_open(&nl);