socket-util: socket_address_equal_unix()

This commit is contained in:
Ivan Kruglov
2025-05-13 01:55:15 -07:00
parent ea6075a26e
commit e739395f13
2 changed files with 19 additions and 0 deletions
+18
View File
@@ -1797,6 +1797,24 @@ int socket_address_parse_unix(SocketAddress *ret_address, const char *s) {
return 0;
}
int socket_address_equal_unix(const char *a, const char *b) {
SocketAddress socket_a, socket_b;
int r;
assert(a);
assert(b);
r = socket_address_parse_unix(&socket_a, a);
if (r < 0)
return r;
r = socket_address_parse_unix(&socket_b, b);
if (r < 0)
return r;
return sockaddr_equal(&socket_a.sockaddr, &socket_b.sockaddr);
}
int vsock_parse_port(const char *s, unsigned *ret) {
int r;