X-Git-Url: http://git.annexia.org/?p=libguestfs.git;a=blobdiff_plain;f=perl%2Flib%2FSys%2FGuestfs%2FLib.pm;h=b5b3906c8fc49d2d077906888fbdf754001f8d0a;hp=ade4a6fe9c5175409bd1a698da5304a999e307d9;hb=2b43970c8c97f24b1f45c040c6963d30661fa514;hpb=ebfcb7f23df4546977628dc718982730682a68c0 diff --git a/perl/lib/Sys/Guestfs/Lib.pm b/perl/lib/Sys/Guestfs/Lib.pm index ade4a6f..b5b3906 100644 --- a/perl/lib/Sys/Guestfs/Lib.pm +++ b/perl/lib/Sys/Guestfs/Lib.pm @@ -20,6 +20,8 @@ package Sys::Guestfs::Lib; use strict; use warnings; +use Carp qw(croak); + use Sys::Guestfs; use File::Temp qw/tempdir/; use Locale::TextDomain 'libguestfs'; @@ -140,14 +142,14 @@ sub open_guest } elsif (ref ($first) eq "SCALAR") { @images = ($first); } else { - die __"open_guest: first parameter must be a string or an arrayref" + croak __"open_guest: first parameter must be a string or an arrayref" } my ($conn, $dom); if (-e $images[0]) { foreach (@images) { - die __x("guest image {imagename} does not exist or is not readable", + croak __x("guest image {imagename} does not exist or is not readable", imagename => $_) unless -r $_; } @@ -1670,9 +1672,6 @@ sub _check_for_kernels eval { $boot{default} = $g->aug_get("/files/$grub_conf/default"); }; - if($@) { - warn __"No grub default specified"; - } $os->{boot} = \%boot; } @@ -1826,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); };