diff options
author | Tom Gundersen <teg@jklm.no> | 2014-04-11 00:04:39 +0200 |
---|---|---|
committer | Tom Gundersen <teg@jklm.no> | 2014-04-11 00:52:23 +0200 |
commit | bc078e7163a826126e9ba03934978f510e9ef9e5 (patch) | |
tree | 2cb386cebaec29959c56a75c165b48f8729b6d35 /src/libsystemd/sd-rtnl/sd-rtnl.c | |
parent | 5ba85788ab3b934db90b42508c7a7892277b5e94 (diff) |
sd-rtnl: use SO_PASSCRED
This unifies the socket handling with other sd-* libraries.
Diffstat (limited to 'src/libsystemd/sd-rtnl/sd-rtnl.c')
-rw-r--r-- | src/libsystemd/sd-rtnl/sd-rtnl.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/libsystemd/sd-rtnl/sd-rtnl.c b/src/libsystemd/sd-rtnl/sd-rtnl.c index 816018a6c4..367f165a1c 100644 --- a/src/libsystemd/sd-rtnl/sd-rtnl.c +++ b/src/libsystemd/sd-rtnl/sd-rtnl.c @@ -72,7 +72,7 @@ static bool rtnl_pid_changed(sd_rtnl *rtnl) { int sd_rtnl_open(sd_rtnl **ret, uint32_t groups) { _cleanup_rtnl_unref_ sd_rtnl *rtnl = NULL; socklen_t addrlen; - int r; + int r, one = 1; assert_return(ret, -EINVAL); @@ -84,6 +84,9 @@ int sd_rtnl_open(sd_rtnl **ret, uint32_t groups) { if (rtnl->fd < 0) return -errno; + if (setsockopt(rtnl->fd, SOL_SOCKET, SO_PASSCRED, &one, sizeof(one)) < 0) + return -errno; + rtnl->sockaddr.nl.nl_groups = groups; addrlen = sizeof(rtnl->sockaddr); |