summaryrefslogtreecommitdiff
path: root/src/udev/udev-ctrl.c
diff options
context:
space:
mode:
authorHarald Hoyer <harald@redhat.com>2013-06-02 12:57:36 -0400
committerAnthony G. Basile <blueness@gentoo.org>2013-06-02 12:57:36 -0400
commitca5fc30e5a230beff018a2a4d528f7e32d941d0f (patch)
tree348b8a6b87669c3e5d796cfd0138a6647471bbc0 /src/udev/udev-ctrl.c
parent786cd8191bff8540133095f4ed48e9e889cdf5be (diff)
udev/udev-ctrl.c:udev_ctrl_new_from_fd() enable SO_PASSCRED
Avoid "sender uid=65534, message ignored" case, where no credentials can be read on the sender side. Seems, the server socket does not enable credential receiving fast enough, and the message from the client (without credential) sometimes is queued before the credential passing was active. Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
Diffstat (limited to 'src/udev/udev-ctrl.c')
-rw-r--r--src/udev/udev-ctrl.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/udev/udev-ctrl.c b/src/udev/udev-ctrl.c
index 4586b014e7..d8c57b216e 100644
--- a/src/udev/udev-ctrl.c
+++ b/src/udev/udev-ctrl.c
@@ -73,6 +73,7 @@ struct udev_ctrl_connection {
struct udev_ctrl *udev_ctrl_new_from_fd(struct udev *udev, int fd)
{
struct udev_ctrl *uctrl;
+ const int on = 1;
uctrl = calloc(1, sizeof(struct udev_ctrl));
if (uctrl == NULL)
@@ -91,6 +92,7 @@ struct udev_ctrl *udev_ctrl_new_from_fd(struct udev *udev, int fd)
uctrl->bound = true;
uctrl->sock = fd;
}
+ setsockopt(uctrl->sock, SOL_SOCKET, SO_PASSCRED, &on, sizeof(on));
uctrl->saddr.sun_family = AF_LOCAL;
util_strscpy(uctrl->saddr.sun_path, sizeof(uctrl->saddr.sun_path), "/run/udev/control");