Don't die during inspection if initrd doesn't exist
[libguestfs.git] / perl / lib / Sys / Guestfs / Lib.pm
index 5428b10..b5b3906 100644 (file)
@@ -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);
         };