]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
dev-setup: do not create a dangling /proc/kcore symlink
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Mon, 10 Jun 2013 12:50:59 +0000 (08:50 -0400)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Mon, 10 Jun 2013 12:50:59 +0000 (08:50 -0400)
https://bugs.freedesktop.org/show_bug.cgi?id=65382
https://bugs.gentoo.org/472060?id=472060

src/shared/dev-setup.c

index b0ac02d4611ef6e7110624d5764036161b350b5f..50a187fda914c764a0493bbee9ff5c2ee27805f8 100644 (file)
@@ -54,13 +54,19 @@ void dev_setup(const char *prefix) {
         const char *j, *k;
 
         static const char symlinks[] =
-                "/proc/kcore\0"      "/dev/core\0"
+                "-/proc/kcore\0"     "/dev/core\0"
                 "/proc/self/fd\0"    "/dev/fd\0"
                 "/proc/self/fd/0\0"  "/dev/stdin\0"
                 "/proc/self/fd/1\0"  "/dev/stdout\0"
                 "/proc/self/fd/2\0"  "/dev/stderr\0";
 
         NULSTR_FOREACH_PAIR(j, k, symlinks) {
+                if (j[0] == '-') {
+                        j++;
+
+                        if (access(j, F_OK))
+                                continue;
+                }
 
                 if (prefix) {
                         char *linkname;