summaryrefslogtreecommitdiffstats
path: root/src/libsystemd/sd-netlink/sd-netlink.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2021-02-10 18:11:20 +0100
committerLennart Poettering <lennart@poettering.net>2021-02-10 22:01:24 +0100
commit13ec9f103b53ecc555a16048c3901d3320b26ef3 (patch)
tree1cfbf7aad8989e492835137c3c6c5a3fef9f11a4 /src/libsystemd/sd-netlink/sd-netlink.c
parentsd-netlink: revamp message serial handling (diff)
downloadsystemd-13ec9f103b53ecc555a16048c3901d3320b26ef3.tar.xz
systemd-13ec9f103b53ecc555a16048c3901d3320b26ef3.zip
sd-netlink: use getsockopt_int() where appropriate
Diffstat (limited to '')
-rw-r--r--src/libsystemd/sd-netlink/sd-netlink.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/src/libsystemd/sd-netlink/sd-netlink.c b/src/libsystemd/sd-netlink/sd-netlink.c
index 6220798b76..b0a1eb77ec 100644
--- a/src/libsystemd/sd-netlink/sd-netlink.c
+++ b/src/libsystemd/sd-netlink/sd-netlink.c
@@ -92,9 +92,7 @@ static bool rtnl_pid_changed(const sd_netlink *rtnl) {
int sd_netlink_open_fd(sd_netlink **ret, int fd) {
_cleanup_(sd_netlink_unrefp) sd_netlink *rtnl = NULL;
- int r;
- int protocol;
- socklen_t l;
+ int r, protocol;
assert_return(ret, -EINVAL);
assert_return(fd >= 0, -EBADF);
@@ -103,8 +101,7 @@ int sd_netlink_open_fd(sd_netlink **ret, int fd) {
if (r < 0)
return r;
- l = sizeof(protocol);
- r = getsockopt(fd, SOL_SOCKET, SO_PROTOCOL, &protocol, &l);
+ r = getsockopt_int(fd, SOL_SOCKET, SO_PROTOCOL, &protocol);
if (r < 0)
return r;