summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKay Sievers <kay@vrfy.org>2013-12-18 22:30:26 +0100
committerAnthony G. Basile <blueness@gentoo.org>2014-01-09 17:22:31 -0500
commitc57e300090145dc185bd3f85d7d8dcf1cb85fa81 (patch)
tree9746f5a3dc80b730c9090622f4447ef7049d1a46 /src
parent3eecd9adb5a832390b1d6d0b607e3735e92f6b0a (diff)
libudev: monitor - only disallow "udev" type events
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
Diffstat (limited to 'src')
-rw-r--r--src/libudev/libudev-monitor.c40
1 files changed, 20 insertions, 20 deletions
diff --git a/src/libudev/libudev-monitor.c b/src/libudev/libudev-monitor.c
index 8e254975db..fa20a69e85 100644
--- a/src/libudev/libudev-monitor.c
+++ b/src/libudev/libudev-monitor.c
@@ -115,7 +115,7 @@ static bool udev_has_devtmpfs(struct udev *udev) {
int r;
h = alloca(MAX_HANDLE_SZ);
-
+ h->handle_bytes = MAX_HANDLE_SZ;
r = name_to_handle_at(AT_FDCWD, "/dev", h, &mount_id, 0);
if (r < 0)
return false;
@@ -126,7 +126,6 @@ static bool udev_has_devtmpfs(struct udev *udev) {
return false;
FOREACH_LINE(line, f, return false) {
- _cleanup_free_ char *opts = NULL;
int mid;
if (sscanf(line, "%i", &mid) != 1)
@@ -172,28 +171,29 @@ struct udev_monitor *udev_monitor_new_from_netlink_fd(struct udev *udev, const c
if (name == NULL)
group = UDEV_MONITOR_NONE;
- else if (streq(name, "udev"))
- group = UDEV_MONITOR_UDEV;
- else if (streq(name, "kernel"))
+ else if (streq(name, "udev")) {
+ /*
+ * We do not support subscribing to uevents if no instance of
+ * udev is running. Uevents would otherwise broadcast the
+ * processing data of the host into containers, which is not
+ * desired.
+ *
+ * Containers will currently not get any udev uevents, until
+ * a supporting infrastructure is available.
+ *
+ * We do not set a netlink multicast group here, so the socket
+ * will not receive any messages.
+ */
+ if (!udev_has_service(udev) && !udev_has_devtmpfs(udev)) {
+ udev_dbg(udev, "the udev service seems not to be active, disable the monitor\n");
+ group = UDEV_MONITOR_NONE;
+ } else
+ group = UDEV_MONITOR_UDEV;
+ } else if (streq(name, "kernel"))
group = UDEV_MONITOR_KERNEL;
else
return NULL;
- /*
- * We do not support subscribing to uevents if no instance of udev
- * is running. Uevents would otherwise broadcast the processing data
- * of the host into containers, which is not acceptable. Containers
- * will currently just not get any uevents.
- *
- * We clear the netlink multicast group here, so the socket will
- * not receive any messages.
- */
-
- if (!udev_has_service(udev) && !udev_has_devtmpfs(udev)) {
- udev_dbg(udev, "udev seems not to be active, disable the monitor\n");
- group = 0;
- }
-
udev_monitor = udev_monitor_new(udev);
if (udev_monitor == NULL)
return NULL;