[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Libguestfs] [PATCH] perl: Check all images are defined in first param of open_guest.



-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
libguestfs lets you edit virtual machines.  Supports shell scripting,
bindings from many languages.  http://et.redhat.com/~rjones/libguestfs/
See what it can do: http://et.redhat.com/~rjones/libguestfs/recipes.html
>From e67e216118df3a724482cb698a868ecbaacbf326 Mon Sep 17 00:00:00 2001
From: Richard Jones <rjones redhat com>
Date: Fri, 11 Jun 2010 10:40:48 +0100
Subject: [PATCH] perl: Check all images are defined in first param of open_guest.

---
 perl/lib/Sys/Guestfs/Lib.pm |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/perl/lib/Sys/Guestfs/Lib.pm b/perl/lib/Sys/Guestfs/Lib.pm
index 128f7c9..bdc788e 100644
--- a/perl/lib/Sys/Guestfs/Lib.pm
+++ b/perl/lib/Sys/Guestfs/Lib.pm
@@ -152,6 +152,13 @@ sub open_guest
         croak __"open_guest: first parameter must be a string or an arrayref"
     }
 
+    # Check each element of @images is defined.
+    # (See https://bugzilla.redhat.com/show_bug.cgi?id=601092#c3).
+    foreach (@images) {
+        croak __"open_guest: first argument contains undefined element"
+            unless defined $_;
+    }
+
     my ($conn, $dom);
 
     if (-e $images[0]) {
-- 
1.6.6.1


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]