* [PATCH 2/3] udevd: try to create the links only when the target
@ 2010-08-06 7:26 Yin Kangkai
2010-08-08 18:37 ` [PATCH 2/3] udevd: try to create the links only when the Martin Pitt
0 siblings, 1 reply; 2+ messages in thread
From: Yin Kangkai @ 2010-08-06 7:26 UTC (permalink / raw)
To: linux-hotplug
From 966aab6e1035e607f7c7f4329393bf68c39d49da Mon Sep 17 00:00:00 2001
From: Yin Kangkai <kangkai.yin@intel.com>
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@intel.com>
---
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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH 2/3] udevd: try to create the links only when the
2010-08-06 7:26 [PATCH 2/3] udevd: try to create the links only when the target Yin Kangkai
@ 2010-08-08 18:37 ` Martin Pitt
0 siblings, 0 replies; 2+ messages in thread
From: Martin Pitt @ 2010-08-08 18:37 UTC (permalink / raw)
To: linux-hotplug
Hello Yin,
Yin Kangkai [2010-08-06 15:26 +0800]:
> udevd: try to create the links only when the target exists
Thanks! Applied with some typo fixes and a clarified description.
Martin
--
Martin Pitt | http://www.piware.de
Ubuntu Developer (www.ubuntu.com) | Debian Developer (www.debian.org)
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-08-08 18:37 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-08-06 7:26 [PATCH 2/3] udevd: try to create the links only when the target Yin Kangkai
2010-08-08 18:37 ` [PATCH 2/3] udevd: try to create the links only when the Martin Pitt
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.