socket-util: Replace sockaddr length macros with functions
There's no need for these to be macros, let's just make them regular functions instead.
This commit is contained in:
@@ -680,16 +680,16 @@ int local_outbounds(
|
||||
* make use of the binding and return it. Hence, let's not unnecessarily fail early here: we
|
||||
* can still easily detect if the auto-binding worked or not, by comparing the bound IP
|
||||
* address with zero — which we do below. */
|
||||
if (connect(fd, &sa.sa, SOCKADDR_LEN(sa)) < 0)
|
||||
if (connect(fd, &sa.sa, sockaddr_len(&sa)) < 0)
|
||||
log_debug_errno(errno, "Failed to connect SOCK_DGRAM socket to gateway, ignoring: %m");
|
||||
|
||||
/* Let's now read the socket address of the socket. A routing decision should have been
|
||||
* made. Let's verify that and use the data. */
|
||||
salen = SOCKADDR_LEN(sa);
|
||||
salen = sockaddr_len(&sa);
|
||||
if (getsockname(fd, &sa.sa, &salen) < 0)
|
||||
return -errno;
|
||||
assert(sa.sa.sa_family == i->family);
|
||||
assert(salen == SOCKADDR_LEN(sa));
|
||||
assert(salen == sockaddr_len(&sa));
|
||||
|
||||
switch (i->family) {
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ int plymouth_connect(int flags) {
|
||||
if (fd < 0)
|
||||
return -errno;
|
||||
|
||||
if (connect(fd, &sa.sa, SOCKADDR_UN_LEN(sa.un)) < 0)
|
||||
if (connect(fd, &sa.sa, sockaddr_un_len(&sa.un)) < 0)
|
||||
return -errno;
|
||||
|
||||
return TAKE_FD(fd);
|
||||
|
||||
Reference in New Issue
Block a user