mirror of
https://github.com/systemd/systemd
synced 2024-07-23 11:14:59 +00:00
socket-util: fix socket_get_family()
Function didn't actually return anything useful. Quite a shame.
This commit is contained in:
parent
862481ece0
commit
5f64d2bf33
|
@ -1307,7 +1307,7 @@ ssize_t recvmsg_safe(int sockfd, struct msghdr *msg, int flags) {
|
|||
return n;
|
||||
}
|
||||
|
||||
int socket_get_family(int fd, int *ret) {
|
||||
int socket_get_family(int fd) {
|
||||
int af;
|
||||
socklen_t sl = sizeof(af);
|
||||
|
||||
|
@ -1321,12 +1321,11 @@ int socket_get_family(int fd, int *ret) {
|
|||
}
|
||||
|
||||
int socket_set_recvpktinfo(int fd, int af, bool b) {
|
||||
int r;
|
||||
|
||||
if (af == AF_UNSPEC) {
|
||||
r = socket_get_family(fd, &af);
|
||||
if (r < 0)
|
||||
return r;
|
||||
af = socket_get_family(fd);
|
||||
if (af < 0)
|
||||
return af;
|
||||
}
|
||||
|
||||
switch (af) {
|
||||
|
@ -1350,12 +1349,11 @@ int socket_set_recvpktinfo(int fd, int af, bool b) {
|
|||
|
||||
int socket_set_unicast_if(int fd, int af, int ifi) {
|
||||
be32_t ifindex_be = htobe32(ifi);
|
||||
int r;
|
||||
|
||||
if (af == AF_UNSPEC) {
|
||||
r = socket_get_family(fd, &af);
|
||||
if (r < 0)
|
||||
return r;
|
||||
af = socket_get_family(fd);
|
||||
if (af < 0)
|
||||
return af;
|
||||
}
|
||||
|
||||
switch (af) {
|
||||
|
@ -1372,12 +1370,10 @@ int socket_set_unicast_if(int fd, int af, int ifi) {
|
|||
}
|
||||
|
||||
int socket_set_option(int fd, int af, int opt_ipv4, int opt_ipv6, int val) {
|
||||
int r;
|
||||
|
||||
if (af == AF_UNSPEC) {
|
||||
r = socket_get_family(fd, &af);
|
||||
if (r < 0)
|
||||
return r;
|
||||
af = socket_get_family(fd);
|
||||
if (af < 0)
|
||||
return af;
|
||||
}
|
||||
|
||||
switch (af) {
|
||||
|
@ -1397,9 +1393,9 @@ int socket_get_mtu(int fd, int af, size_t *ret) {
|
|||
int mtu, r;
|
||||
|
||||
if (af == AF_UNSPEC) {
|
||||
r = socket_get_family(fd, &af);
|
||||
if (r < 0)
|
||||
return r;
|
||||
af = socket_get_family(fd);
|
||||
if (af < 0)
|
||||
return af;
|
||||
}
|
||||
|
||||
switch (af) {
|
||||
|
|
|
@ -306,7 +306,7 @@ struct timespec_large {
|
|||
|
||||
ssize_t recvmsg_safe(int sockfd, struct msghdr *msg, int flags);
|
||||
|
||||
int socket_get_family(int fd, int *ret);
|
||||
int socket_get_family(int fd);
|
||||
int socket_set_recvpktinfo(int fd, int af, bool b);
|
||||
int socket_set_unicast_if(int fd, int af, int ifi);
|
||||
|
||||
|
|
|
@ -1749,9 +1749,9 @@ int socket_disable_pmtud(int fd, int af) {
|
|||
assert(fd >= 0);
|
||||
|
||||
if (af == AF_UNSPEC) {
|
||||
r = socket_get_family(fd, &af);
|
||||
if (r < 0)
|
||||
return r;
|
||||
af = socket_get_family(fd);
|
||||
if (af < 0)
|
||||
return af;
|
||||
}
|
||||
|
||||
switch (af) {
|
||||
|
|
Loading…
Reference in a new issue