| 
    
 [Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH] libxl: fix printing hotplug arguments/environment
 A OS could decide to not pass arguments or any environment variables to
hotplug scripts, and this will trigger a bug in device_hotplug logic, since
it expects both the argument and the environment arrays to exist. Allow
both args or env to be NULL.
Signed-off-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
---
Cc: Wei Liu <wei.liu2@xxxxxxxxxx>
Cc: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
---
 tools/libxl/libxl_device.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tools/libxl/libxl_device.c b/tools/libxl/libxl_device.c
index b9a6df2..0e5f546 100644
--- a/tools/libxl/libxl_device.c
+++ b/tools/libxl/libxl_device.c
@@ -1132,7 +1132,7 @@ static void device_hotplug(libxl__egc *egc, 
libxl__ao_device *aodev)
 
     LOG(DEBUG, "calling hotplug script: %s %s", args[0], args[1]);
     LOG(DEBUG, "extra args:");
-    {
+    if ( args != NULL) {
         const char *arg;
         unsigned int x;
 
@@ -1140,7 +1140,7 @@ static void device_hotplug(libxl__egc *egc, 
libxl__ao_device *aodev)
             LOG(DEBUG, "\t%s", arg);
     }
     LOG(DEBUG, "env:");
-    {
+    if ( env != NULL) {
         const char *k, *v;
         unsigned int x;
 
-- 
2.7.4 (Apple Git-66)
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel
 
  | 
  
![]()  | 
            
         Lists.xenproject.org is hosted with RackSpace, monitoring our  |