[Libguestfs] [PATCH 4/4] febootstrap/helper/init: Mount /proc if not already present.

Hilko Bengen bengen at hilluzination.de
Tue May 31 22:43:12 UTC 2011


---
 helper/init.c |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/helper/init.c b/helper/init.c
index 40f0e43..a7f55cd 100644
--- a/helper/init.c
+++ b/helper/init.c
@@ -56,6 +56,17 @@ static char line[1024];
 int
 main ()
 {
+  struct stat s;
+  if ( (stat ("/proc/uptime", &s) == -1) && (errno == ENOENT) ) {
+    mkdir("/proc", 0755);
+    if (verbose)
+      fprintf (stderr, "febootstrap: mounting /proc\n");
+    if (mount ("proc", "/proc", "proc", 0, "") == -1) {
+      perror ("mount: /proc");
+      exit (EXIT_FAILURE);
+    }
+  }
+
   print_uptime ();
   fprintf (stderr, "febootstrap: ext2 mini initrd starting up\n");
 
-- 
1.7.5.3




More information about the Libguestfs mailing list