>From 966aab6e1035e607f7c7f4329393bf68c39d49da Mon Sep 17 00:00:00 2001 From: Yin Kangkai <kangkai.yin@xxxxxxxxx> Date: Thu, 5 Aug 2010 16:17:00 +0800 Subject: [PATCH 2/3] udevd: try to create the links only when the target exists For example, not all the systems have the PROC_KCORE enalbed but a broken symbol link be created in spite of that. Signed-off-by: Yin Kangkai <kangkai.yin@xxxxxxxxx> --- udev/udevd.c | 12 ++++++++---- 1 files changed, 8 insertions(+), 4 deletions(-) diff --git a/udev/udevd.c b/udev/udevd.c index 6dc9795..61b76f5 100644 --- a/udev/udevd.c +++ b/udev/udevd.c @@ -900,10 +900,14 @@ static void static_dev_create_links(struct udev *udev, DIR *dir) unsigned int i; for (i = 0; i < ARRAY_SIZE(stdlinks); i++) { - udev_selinux_setfscreateconat(udev, dirfd(dir), stdlinks[i].link, S_IFLNK); - if (symlinkat(stdlinks[i].target, dirfd(dir), stdlinks[i].link) < 0 && errno == EEXIST) - utimensat(dirfd(dir), stdlinks[i].link, NULL, AT_SYMLINK_NOFOLLOW); - udev_selinux_resetfscreatecon(udev); + struct stat sb; + + if (stat(stdlinks[i].target, &sb) == 0) { + udev_selinux_setfscreateconat(udev, dirfd(dir), stdlinks[i].link, S_IFLNK); + if (symlinkat(stdlinks[i].target, dirfd(dir), stdlinks[i].link) < 0 && errno == EEXIST) + utimensat(dirfd(dir), stdlinks[i].link, NULL, AT_SYMLINK_NOFOLLOW); + udev_selinux_resetfscreatecon(udev); + } } } -- 1.6.5 -- To unsubscribe from this list: send the line "unsubscribe linux-hotplug" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html