[Libvirt-cim] [PATCH] Fix asprintf warning in DevicePool

Dan Smith danms at us.ibm.com
Sat Oct 27 16:59:16 UTC 2007


# HG changeset patch
# User Dan Smith <danms at us.ibm.com>
# Date 1193504300 25200
# Node ID b00e3353ccec10cdd9c3e6882067b2b73a5bd448
# Parent  aaad430ea766d9a3bc0be035e595d8da17ee2122
Fix asprintf warning in DevicePool
This fixes the compile warning (error) that was preventing a compile on
Fedora 7.

Signed-off-by: Dan Smith <danms at us.ibm.com>

diff -r aaad430ea766 -r b00e3353ccec src/Virt_DevicePool.c
--- a/src/Virt_DevicePool.c	Fri Oct 26 13:34:26 2007 -0700
+++ b/src/Virt_DevicePool.c	Sat Oct 27 09:58:20 2007 -0700
@@ -70,9 +70,11 @@ static char *netpool_member_of(const CMP
 
         for (i = 0; i < count; i++) {
                 if (STREQ((devs[i].id), dev)) {
-                        asprintf(&result,
-                                 "NetworkPool/%s",
-                                 devs[i].dev.net.bridge);
+                        ret = asprintf(&result,
+                                       "NetworkPool/%s",
+                                       devs[i].dev.net.bridge);
+                        if (ret == -1)
+                                result = NULL;
                         break;
                 }
         }




More information about the Libvirt-cim mailing list