udevd: try to create the links only when the target
PATCH 2/3 udevd: try to create the links only when the target
From 966aab6e1035e607f7c7f4329393bf68c39d49da Mon Sep 17 00:00:00 2001
From: Yin Kangkai <[email protected]>
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 <[email protected]>
--- udev/udevd.c | 12 ++++++++---- 1 files changed, 8 insertions(+), 4 deletions(-)
udev/udevd.c +8 -4
@@ -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); + } } }
Signature · 1 line
1.6.5
Martin Pitt
AppliedRe: [PATCH 2/3] udevd: try to create the links only when the
Hello Yin,
Yin Kangkai [2010-08-06 15:26 +0800]:
Quoted 1 line
udevd: try to create the links only when the target exists
Thanks! Applied with some typo fixes and a clarified description.
Martin
Signature · 2 lines
Martin Pitt | http://www.piware.de Ubuntu Developer (www.ubuntu.com) | Debian Developer (www.debian.org)