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

Richard W.M. Jones rjones at redhat.com
Wed Jun 1 08:44:37 UTC 2011


On Wed, Jun 01, 2011 at 12:43:12AM +0200, Hilko Bengen wrote:
> ---
>  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");

ACK, but I'll adjust this patch before I apply it to make the
error non-fatal.

Thanks for your contributions!  I'll post an updated patch
series here for review before I apply anything.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
libguestfs lets you edit virtual machines.  Supports shell scripting,
bindings from many languages.  http://libguestfs.org




More information about the Libguestfs mailing list