summaryrefslogtreecommitdiffstats
path: root/perl/lib
diff options
context:
space:
mode:
authorMatthew Booth <mbooth@redhat.com>2010-04-21 15:39:48 +0100
committerRichard Jones <rjones@redhat.com>2010-04-21 16:51:20 +0100
commit2b43970c8c97f24b1f45c040c6963d30661fa514 (patch)
tree5c3d3d119098648fb2a3795f5280a76e5712cb78 /perl/lib
parent216557b1ebc013701e7474720bc1280f43e51bb1 (diff)
downloadlibguestfs-2b43970c8c97f24b1f45c040c6963d30661fa514.tar.gz
libguestfs-2b43970c8c97f24b1f45c040c6963d30661fa514.tar.xz
libguestfs-2b43970c8c97f24b1f45c040c6963d30661fa514.zip
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.
Diffstat (limited to 'perl/lib')
-rw-r--r--perl/lib/Sys/Guestfs/Lib.pm2
1 files changed, 1 insertions, 1 deletions
diff --git a/perl/lib/Sys/Guestfs/Lib.pm b/perl/lib/Sys/Guestfs/Lib.pm
index 5428b104..b5b3906c 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);
};