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

[Libguestfs] [PATCH nbdkit 2/4] guestfs, libvirt : Rename ‘connect’ global to avoid -Ws hadow warning.



We are going to change <nbdkit-common.h> so it includes
<sys/socket.h>.  However because this exports connect(2) we need to
rename globals called ‘connect’ to avoid a conflict.
---
 plugins/guestfs/guestfs-plugin.c | 8 ++++----
 plugins/libvirt/libvirt-plugin.c | 6 +++---
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/plugins/guestfs/guestfs-plugin.c b/plugins/guestfs/guestfs-plugin.c
index c8af987..a958f41 100644
--- a/plugins/guestfs/guestfs-plugin.c
+++ b/plugins/guestfs/guestfs-plugin.c
@@ -48,7 +48,7 @@
 #include "cleanup.h"
 
 /* Configuration. */
-static const char *connect = NULL; /* libvirt URI */
+static const char *libvirt_uri = NULL; /* libvirt URI */
 static const char *export = NULL;  /* export device or file */
 static const char *format = NULL;  /* format parameter */
 static int trace = 0, debug = 0;
@@ -87,7 +87,7 @@ plugin_guestfs_config (const char *key, const char *value)
     }
   }
   else if (strcmp (key, "connect") == 0) {
-    connect = value;
+    libvirt_uri = value;
   }
   else if (strcmp (key, "export") == 0) {
     export = value;
@@ -355,9 +355,9 @@ add_disks (guestfs_h *g, int readonly, struct drive *drives)
       GUESTFS_ADD_DOMAIN_ALLOWUUID_BITMASK;
     domain_optargs.readonly = readonly;
     domain_optargs.allowuuid = 1;
-    if (connect) {
+    if (libvirt_uri) {
       domain_optargs.bitmask |= GUESTFS_ADD_DOMAIN_LIBVIRTURI_BITMASK;
-      domain_optargs.libvirturi = connect;
+      domain_optargs.libvirturi = libvirt_uri;
     }
     if (guestfs_add_domain_argv (g, drives->value, &domain_optargs) == -1) {
       GERROR (g, "domain %s", drives->value);
diff --git a/plugins/libvirt/libvirt-plugin.c b/plugins/libvirt/libvirt-plugin.c
index 71cac42..5fdaef3 100644
--- a/plugins/libvirt/libvirt-plugin.c
+++ b/plugins/libvirt/libvirt-plugin.c
@@ -55,7 +55,7 @@
 #include <nbdkit-plugin.h>
 
 /* Configuration. */
-static const char *connect = NULL;
+static const char *libvirt_uri = NULL;
 static const char *domain = NULL;
 static const char *disk = NULL;
 
@@ -63,7 +63,7 @@ static int
 virt_config (const char *key, const char *value)
 {
   if (strcmp (key, "connect") == 0) {
-    connect = value;
+    libvirt_uri = value;
   }
   else if (strcmp (key, "domain") == 0) {
     domain = value;
@@ -119,7 +119,7 @@ virt_open (int readonly)
   }
 
   /* Connect to libvirt. */
-  h->conn = virConnectOpen (connect);
+  h->conn = virConnectOpen (libvirt_uri);
   if (!h->conn) {
     nbdkit_error ("virConnectOpen failed, see earlier error messages");
     goto err1;
-- 
2.23.0


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