[rhel5-branch] [PATCH] Create /dev/* symlinks after we mount tmpfs on /dev

Vratislav Podzimek vpodzime at redhat.com
Thu Sep 13 11:33:00 UTC 2012


Creating them in mk-images results in these files missing after
we mount tmpfs on /dev in our init.

Resolves: rhbz#784159

Signed-off-by: Vratislav Podzimek <vpodzime at redhat.com>
---
 loader2/init.c    | 7 +++++++
 scripts/mk-images | 7 -------
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/loader2/init.c b/loader2/init.c
index 782526b..1717fcf 100644
--- a/loader2/init.c
+++ b/loader2/init.c
@@ -482,6 +482,13 @@ static void createDevices(void) {
                     strerror(errno));
     }
 
+    /* some of these may fail if the links already exist, but that means
+    we don't need to create them */
+    symlink("/proc/self/fd/0", "/dev/stdin");
+    symlink("/proc/self/fd/1", "/dev/stdout");
+    symlink("/proc/self/fd/2", "/dev/stderr");
+    symlink("/proc/self/fd", "/dev/fd");
+
     /* Restore umask for minimal side affects */
     umask(previous_umask); 
 }
diff --git a/scripts/mk-images b/scripts/mk-images
index 4823ad0..ce3beb6 100755
--- a/scripts/mk-images
+++ b/scripts/mk-images
@@ -606,13 +606,6 @@ makeinitrd() {
     mkdir -p $MBD_DIR/var/run/rhsm
     mkdir -p $MBD_DIR/var/lock/rpm
 
-    ( cd $MBD_DIR/dev
-      ln -sf /proc/self/fd/0 stdin
-      ln -sf /proc/self/fd/1 stdout
-      ln -sf /proc/self/fd/2 stderr
-      ln -sf /proc/self/fd fd
-    )
-
     if [ "$BUILDARCH" = "ppc" -o "$BUILDARCH" = "ppc64" ]; then
 	mkdir -p $MBD_DIR/dev/iseries
     fi
-- 
1.7.11.4



More information about the anaconda-patches mailing list