From: Matthew Booth Date: Wed, 21 Apr 2010 14:39:48 +0000 (+0100) Subject: Don't die during inspection if initrd doesn't exist X-Git-Tag: 1.3.6~6 X-Git-Url: http://git.annexia.org/?a=commitdiff_plain;h=2b43970c8c97f24b1f45c040c6963d30661fa514;p=libguestfs.git Don't die during inspection if initrd doesn't exist This fixes a problem where inspection would die if grub.conf referenced a non-existent initrd. Just return an empty initrd instead. --- 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); };