[Libguestfs] [PATCH 1/2] Don't die during inspection if initrd doesn't exist

Richard W.M. Jones rjones at redhat.com
Wed Apr 21 15:50:02 UTC 2010


On Wed, Apr 21, 2010 at 03:39:48PM +0100, Matthew Booth wrote:
> This fixes a problem where inspection would die if grub.conf referenced a
> non-existent initrd. Just return an empty initrd instead.
> ---
>  perl/lib/Sys/Guestfs/Lib.pm |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/perl/lib/Sys/Guestfs/Lib.pm b/perl/lib/Sys/Guestfs/Lib.pm
> index 5428b10..b5b3906 100644
> --- a/perl/lib/Sys/Guestfs/Lib.pm
> +++ b/perl/lib/Sys/Guestfs/Lib.pm
> @@ -1825,7 +1825,7 @@ sub _inspect_initrd
>      # Disregard old-style compressed ext2 files and only work with real
>      # compressed cpio files, since cpio takes ages to (fail to) process anything
>      # else.
> -    if ($g->file ($path) =~ /cpio/) {
> +    if ($g->exists($path) && $g->file($path) =~ /cpio/) {
>          eval {
>              @modules = $g->initrd_list ($path);
>          };
> -- 
> 1.6.6.1

ACK.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
virt-top is 'top' for virtual machines.  Tiny program with many
powerful monitoring features, net stats, disk stats, logging, etc.
http://et.redhat.com/~rjones/virt-top




More information about the Libguestfs mailing list