X-Git-Url: http://git.ipfire.org/?a=blobdiff_plain;f=src%2Flibudev%2Flibudev-monitor.c;fp=src%2Flibudev%2Flibudev-monitor.c;h=5ca035d43ccac64353f00fc69e51c2fc0bc604fe;hb=be1791ad6a09d08f6234ba53e45d022e3269dffd;hp=f83115c95ce567e0d95456ac58c4c5a549ab130a;hpb=3d01fa902c3804417126c2b846f671c710669ce8;p=thirdparty%2Fsystemd.git diff --git a/src/libudev/libudev-monitor.c b/src/libudev/libudev-monitor.c index f83115c95ce..5ca035d43cc 100644 --- a/src/libudev/libudev-monitor.c +++ b/src/libudev/libudev-monitor.c @@ -94,46 +94,6 @@ static struct udev_monitor *udev_monitor_new(struct udev *udev) { return udev_monitor; } -/* we consider udev running when /dev is on devtmpfs */ -static bool udev_has_devtmpfs(struct udev *udev) { - - _cleanup_fclose_ FILE *f = NULL; - char line[LINE_MAX], *e; - int mount_id, r; - - r = path_get_mnt_id("/dev", &mount_id); - if (r < 0) { - if (r != -EOPNOTSUPP) - log_debug_errno(r, "name_to_handle_at on /dev: %m"); - - return false; - } - - f = fopen("/proc/self/mountinfo", "re"); - if (!f) - return false; - - FOREACH_LINE(line, f, return false) { - int mid; - - if (sscanf(line, "%i", &mid) != 1) - continue; - - if (mid != mount_id) - continue; - - e = strstr(line, " - "); - if (!e) - continue; - - /* accept any name that starts with the currently expected type */ - if (startswith(e + 3, "devtmpfs")) - return true; - } - - return false; -} - static void monitor_set_nl_address(struct udev_monitor *udev_monitor) { union sockaddr_union snl; socklen_t addrlen; @@ -169,7 +129,7 @@ struct udev_monitor *udev_monitor_new_from_netlink_fd(struct udev *udev, const c * We do not set a netlink multicast group here, so the socket * will not receive any messages. */ - if (access("/run/udev/control", F_OK) < 0 && !udev_has_devtmpfs(udev)) { + if (access("/run/udev/control", F_OK) < 0 && dev_is_devtmpfs() <= 0) { log_debug("the udev service seems not to be active, disable the monitor"); group = UDEV_MONITOR_NONE; } else