[PATCH] build: fix build on RHEL-6

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

 



GCC in RHEL-6 complains about listen:

../../src/conf/domain_conf.c:23718: error: declaration of 'listen' shadows a global declaration [-Wshadow]
/usr/include/sys/socket.h:204: error: shadowed declaration is here [-Wshadow]

This renames all the listen to gListen.

Signed-off-by: Pavel Hrdina <phrdina@xxxxxxxxxx>
---

Pushed under build breaker rule.

 src/conf/domain_conf.c     | 12 ++++++------
 src/libxl/libxl_conf.c     | 16 ++++++++--------
 src/qemu/qemu_command.c    | 28 ++++++++++++++--------------
 src/qemu/qemu_migration.c  |  6 +++---
 src/vbox/vbox_common.c     | 10 +++++-----
 src/vmx/vmx.c              |  8 ++++----
 src/vz/vz_sdk.c            |  8 ++++----
 src/xenconfig/xen_common.c | 14 +++++++-------
 src/xenconfig/xen_sxpr.c   | 16 ++++++++--------
 src/xenconfig/xen_xl.c     |  8 ++++----
 10 files changed, 63 insertions(+), 63 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 446fbc5..12a3a50 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -23715,21 +23715,21 @@ int
 virDomainGraphicsListenAppendAddress(virDomainGraphicsDefPtr def,
                                      const char *address)
 {
-    virDomainGraphicsListenDef listen;
+    virDomainGraphicsListenDef gListen;
 
-    memset(&listen, 0, sizeof(listen));
+    memset(&gListen, 0, sizeof(gListen));
 
-    listen.type = VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_ADDRESS;
+    gListen.type = VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_ADDRESS;
 
-    if (VIR_STRDUP(listen.address, address) < 0)
+    if (VIR_STRDUP(gListen.address, address) < 0)
         goto error;
 
-    if (VIR_APPEND_ELEMENT_COPY(def->listens, def->nListens, listen) < 0)
+    if (VIR_APPEND_ELEMENT_COPY(def->listens, def->nListens, gListen) < 0)
         goto error;
 
     return 0;
  error:
-    VIR_FREE(listen.address);
+    VIR_FREE(gListen.address);
     return -1;
 }
 
diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c
index a2ef1bd..30f2ce9 100644
--- a/src/libxl/libxl_conf.c
+++ b/src/libxl/libxl_conf.c
@@ -1424,7 +1424,7 @@ libxlMakeVfb(virPortAllocatorPtr graphicsports,
              libxl_device_vfb *x_vfb)
 {
     unsigned short port;
-    virDomainGraphicsListenDefPtr listen = NULL;
+    virDomainGraphicsListenDefPtr gListen = NULL;
 
     libxl_device_vfb_init(x_vfb);
 
@@ -1451,11 +1451,11 @@ libxlMakeVfb(virPortAllocatorPtr graphicsports,
             }
             x_vfb->vnc.display = l_vfb->data.vnc.port - LIBXL_VNC_PORT_MIN;
 
-            if ((listen = virDomainGraphicsGetListen(l_vfb, 0)) &&
-                listen->address) {
+            if ((gListen = virDomainGraphicsGetListen(l_vfb, 0)) &&
+                gListen->address) {
                 /* libxl_device_vfb_init() does VIR_STRDUP("127.0.0.1") */
                 VIR_FREE(x_vfb->vnc.listen);
-                if (VIR_STRDUP(x_vfb->vnc.listen, listen->address) < 0)
+                if (VIR_STRDUP(x_vfb->vnc.listen, gListen->address) < 0)
                     return -1;
             }
             if (VIR_STRDUP(x_vfb->vnc.passwd, l_vfb->data.vnc.auth.passwd) < 0)
@@ -1539,7 +1539,7 @@ libxlMakeBuildInfoVfb(virPortAllocatorPtr graphicsports,
     for (i = 0; i < def->ngraphics; i++) {
         virDomainGraphicsDefPtr l_vfb = def->graphics[i];
         unsigned short port;
-        virDomainGraphicsListenDefPtr listen = NULL;
+        virDomainGraphicsListenDefPtr gListen = NULL;
 
         if (l_vfb->type != VIR_DOMAIN_GRAPHICS_TYPE_SPICE)
             continue;
@@ -1553,9 +1553,9 @@ libxlMakeBuildInfoVfb(virPortAllocatorPtr graphicsports,
         }
         b_info->u.hvm.spice.port = l_vfb->data.spice.port;
 
-        if ((listen = virDomainGraphicsGetListen(l_vfb, 0)) &&
-            listen->address &&
-            VIR_STRDUP(b_info->u.hvm.spice.host, listen->address) < 0)
+        if ((gListen = virDomainGraphicsGetListen(l_vfb, 0)) &&
+            gListen->address &&
+            VIR_STRDUP(b_info->u.hvm.spice.host, gListen->address) < 0)
             return -1;
 
         if (VIR_STRDUP(b_info->u.hvm.keymap, l_vfb->data.spice.keymap) < 0)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index da99e5c..31e5408 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -7212,7 +7212,7 @@ qemuBuildGraphicsVNCCommandLine(virQEMUDriverConfigPtr cfg,
                                 const char *domainLibDir)
 {
     virBuffer opt = VIR_BUFFER_INITIALIZER;
-    virDomainGraphicsListenDefPtr listen = NULL;
+    virDomainGraphicsListenDefPtr gListen = NULL;
     const char *listenAddr = NULL;
     char *netAddr = NULL;
     bool escapeAddr;
@@ -7241,18 +7241,18 @@ qemuBuildGraphicsVNCCommandLine(virQEMUDriverConfigPtr cfg,
             goto error;
         }
 
-        if ((listen = virDomainGraphicsGetListen(graphics, 0))) {
+        if ((gListen = virDomainGraphicsGetListen(graphics, 0))) {
 
-            switch (listen->type) {
+            switch (gListen->type) {
             case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_ADDRESS:
-                listenAddr = listen->address;
+                listenAddr = gListen->address;
                 break;
 
             case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_NETWORK:
-                if (!listen->network)
+                if (!gListen->network)
                     break;
 
-                ret = networkGetNetworkAddress(listen->network, &netAddr);
+                ret = networkGetNetworkAddress(gListen->network, &netAddr);
                 if (ret <= -2) {
                     virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                                    "%s", _("network-based listen not possible, "
@@ -7265,7 +7265,7 @@ qemuBuildGraphicsVNCCommandLine(virQEMUDriverConfigPtr cfg,
                 listenAddr = netAddr;
                 /* store the address we found in the <graphics> element so it
                  * will show up in status. */
-                if (VIR_STRDUP(listen->address, netAddr) < 0)
+                if (VIR_STRDUP(gListen->address, netAddr) < 0)
                     goto error;
                 break;
             }
@@ -7359,7 +7359,7 @@ qemuBuildGraphicsSPICECommandLine(virQEMUDriverConfigPtr cfg,
                                   virDomainGraphicsDefPtr graphics)
 {
     virBuffer opt = VIR_BUFFER_INITIALIZER;
-    virDomainGraphicsListenDefPtr listen = NULL;
+    virDomainGraphicsListenDefPtr gListen = NULL;
     const char *listenAddr = NULL;
     char *netAddr = NULL;
     int ret;
@@ -7398,18 +7398,18 @@ qemuBuildGraphicsSPICECommandLine(virQEMUDriverConfigPtr cfg,
     }
 
     if (port > 0 || tlsPort > 0) {
-        if ((listen = virDomainGraphicsGetListen(graphics, 0))) {
+        if ((gListen = virDomainGraphicsGetListen(graphics, 0))) {
 
-            switch (listen->type) {
+            switch (gListen->type) {
             case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_ADDRESS:
-                listenAddr = listen->address;
+                listenAddr = gListen->address;
                 break;
 
             case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_NETWORK:
-                if (!listen->network)
+                if (!gListen->network)
                     break;
 
-                ret = networkGetNetworkAddress(listen->network, &netAddr);
+                ret = networkGetNetworkAddress(gListen->network, &netAddr);
                 if (ret <= -2) {
                     virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                                    "%s", _("network-based listen not possible, "
@@ -7422,7 +7422,7 @@ qemuBuildGraphicsSPICECommandLine(virQEMUDriverConfigPtr cfg,
                 listenAddr = netAddr;
                 /* store the address we found in the <graphics> element so it will
                  * show up in status. */
-                if (VIR_STRDUP(listen->address, listenAddr) < 0)
+                if (VIR_STRDUP(gListen->address, listenAddr) < 0)
                     goto error;
                 break;
             }
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index d0055a2..e72c874 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -314,7 +314,7 @@ qemuMigrationCookieGraphicsAlloc(virQEMUDriverPtr driver,
 {
     qemuMigrationCookieGraphicsPtr mig = NULL;
     const char *listenAddr;
-    virDomainGraphicsListenDefPtr listen = virDomainGraphicsGetListen(def, 0);
+    virDomainGraphicsListenDefPtr gListen = virDomainGraphicsGetListen(def, 0);
     virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
 
     if (VIR_ALLOC(mig) < 0)
@@ -324,7 +324,7 @@ qemuMigrationCookieGraphicsAlloc(virQEMUDriverPtr driver,
     if (mig->type == VIR_DOMAIN_GRAPHICS_TYPE_VNC) {
         mig->port = def->data.vnc.port;
 
-        if (!listen || !(listenAddr = listen->address))
+        if (!gListen || !(listenAddr = gListen->address))
             listenAddr = cfg->vncListen;
 
 #ifdef WITH_GNUTLS
@@ -339,7 +339,7 @@ qemuMigrationCookieGraphicsAlloc(virQEMUDriverPtr driver,
         else
             mig->tlsPort = -1;
 
-        if (!listen || !(listenAddr = listen->address))
+        if (!gListen || !(listenAddr = gListen->address))
             listenAddr = cfg->spiceListen;
 
 #ifdef WITH_GNUTLS
diff --git a/src/vbox/vbox_common.c b/src/vbox/vbox_common.c
index 5ffb493..0cead10 100644
--- a/src/vbox/vbox_common.c
+++ b/src/vbox/vbox_common.c
@@ -1578,7 +1578,7 @@ vboxAttachDisplay(virDomainDefPtr def, vboxGlobalData *data, IMachine *machine)
     char *guiDisplay = NULL;
     char *sdlDisplay = NULL;
     size_t i = 0;
-    virDomainGraphicsListenDefPtr listen;
+    virDomainGraphicsListenDefPtr gListen;
 
     for (i = 0; i < def->ngraphics; i++) {
         IVRDxServer *VRDxServer = NULL;
@@ -1606,15 +1606,15 @@ vboxAttachDisplay(virDomainDefPtr def, vboxGlobalData *data, IMachine *machine)
                     VIR_DEBUG("VRDP set to allow multiple connection");
                 }
 
-                if ((listen = virDomainGraphicsGetListen(def->graphics[i], 0)) &&
-                    listen->address) {
+                if ((gListen = virDomainGraphicsGetListen(def->graphics[i], 0)) &&
+                    gListen->address) {
                     PRUnichar *netAddressUtf16 = NULL;
 
-                    VBOX_UTF8_TO_UTF16(listen->address, &netAddressUtf16);
+                    VBOX_UTF8_TO_UTF16(gListen->address, &netAddressUtf16);
                     gVBoxAPI.UIVRDxServer.SetNetAddress(data, VRDxServer,
                                                         netAddressUtf16);
                     VIR_DEBUG("VRDP listen address is set to: %s",
-                              listen->address);
+                              gListen->address);
 
                     VBOX_UTF16_FREE(netAddressUtf16);
                 }
diff --git a/src/vmx/vmx.c b/src/vmx/vmx.c
index 65b31c8..8c4b4bb 100644
--- a/src/vmx/vmx.c
+++ b/src/vmx/vmx.c
@@ -3403,7 +3403,7 @@ virVMXFormatConfig(virVMXContext *ctx, virDomainXMLOptionPtr xmlopt, virDomainDe
 int
 virVMXFormatVNC(virDomainGraphicsDefPtr def, virBufferPtr buffer)
 {
-    virDomainGraphicsListenDefPtr listen;
+    virDomainGraphicsListenDefPtr gListen;
 
     if (def->type != VIR_DOMAIN_GRAPHICS_TYPE_VNC) {
         virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
@@ -3425,10 +3425,10 @@ virVMXFormatVNC(virDomainGraphicsDefPtr def, virBufferPtr buffer)
                           def->data.vnc.port);
     }
 
-    if ((listen = virDomainGraphicsGetListen(def, 0)) &&
-        listen->address) {
+    if ((gListen = virDomainGraphicsGetListen(def, 0)) &&
+        gListen->address) {
         virBufferAsprintf(buffer, "RemoteDisplay.vnc.ip = \"%s\"\n",
-                          listen->address);
+                          gListen->address);
     }
 
     if (def->data.vnc.keymap != NULL) {
diff --git a/src/vz/vz_sdk.c b/src/vz/vz_sdk.c
index 5d27afd..f0c7f3f 100644
--- a/src/vz/vz_sdk.c
+++ b/src/vz/vz_sdk.c
@@ -2712,7 +2712,7 @@ static int prlsdkCheckFSUnsupportedParams(virDomainFSDefPtr fs)
 static int prlsdkApplyGraphicsParams(PRL_HANDLE sdkdom, virDomainDefPtr def)
 {
     virDomainGraphicsDefPtr gr;
-    virDomainGraphicsListenDefPtr listen;
+    virDomainGraphicsListenDefPtr gListen;
     PRL_RESULT pret;
     int ret  = -1;
 
@@ -2735,10 +2735,10 @@ static int prlsdkApplyGraphicsParams(PRL_HANDLE sdkdom, virDomainDefPtr def)
         prlsdkCheckRetGoto(pret, cleanup);
     }
 
-    if ((listen = virDomainGraphicsGetListen(gr, 0))) {
-        if (!listen->address)
+    if ((gListen = virDomainGraphicsGetListen(gr, 0))) {
+        if (!gListen->address)
             goto cleanup;
-        pret = PrlVmCfg_SetVNCHostName(sdkdom, listen->address);
+        pret = PrlVmCfg_SetVNCHostName(sdkdom, gListen->address);
         prlsdkCheckRetGoto(pret, cleanup);
     }
 
diff --git a/src/xenconfig/xen_common.c b/src/xenconfig/xen_common.c
index 340e488..e1d9cf6 100644
--- a/src/xenconfig/xen_common.c
+++ b/src/xenconfig/xen_common.c
@@ -1628,7 +1628,7 @@ xenFormatVfb(virConfPtr conf, virDomainDefPtr def)
                                        def->graphics[0]->data.sdl.xauth) < 0)
                     return -1;
             } else {
-                virDomainGraphicsListenDefPtr listen;
+                virDomainGraphicsListenDefPtr gListen;
 
                 if (xenConfigSetInt(conf, "sdl", 0) < 0)
                     return -1;
@@ -1645,9 +1645,9 @@ xenFormatVfb(virConfPtr conf, virDomainDefPtr def)
                                     def->graphics[0]->data.vnc.port - 5900) < 0)
                     return -1;
 
-                if ((listen = virDomainGraphicsGetListen(def->graphics[0], 0)) &&
-                    listen->address &&
-                    xenConfigSetString(conf, "vnclisten", listen->address) < 0)
+                if ((gListen = virDomainGraphicsGetListen(def->graphics[0], 0)) &&
+                    gListen->address &&
+                    xenConfigSetString(conf, "vnclisten", gListen->address) < 0)
                     return -1;
 
                 if (def->graphics[0]->data.vnc.auth.passwd &&
@@ -1674,7 +1674,7 @@ xenFormatVfb(virConfPtr conf, virDomainDefPtr def)
                     virBufferAsprintf(&buf, ",xauthority=%s",
                                       def->graphics[0]->data.sdl.xauth);
             } else {
-                virDomainGraphicsListenDefPtr listen
+                virDomainGraphicsListenDefPtr gListen
                     = virDomainGraphicsGetListen(def->graphics[0], 0);
 
                 virBufferAddLit(&buf, "type=vnc");
@@ -1683,8 +1683,8 @@ xenFormatVfb(virConfPtr conf, virDomainDefPtr def)
                 if (!def->graphics[0]->data.vnc.autoport)
                     virBufferAsprintf(&buf, ",vncdisplay=%d",
                                       def->graphics[0]->data.vnc.port - 5900);
-                if (listen && listen->address)
-                    virBufferAsprintf(&buf, ",vnclisten=%s", listen->address);
+                if (gListen && gListen->address)
+                    virBufferAsprintf(&buf, ",vnclisten=%s", gListen->address);
                 if (def->graphics[0]->data.vnc.auth.passwd)
                     virBufferAsprintf(&buf, ",vncpasswd=%s",
                                       def->graphics[0]->data.vnc.auth.passwd);
diff --git a/src/xenconfig/xen_sxpr.c b/src/xenconfig/xen_sxpr.c
index 7211314..2677510 100644
--- a/src/xenconfig/xen_sxpr.c
+++ b/src/xenconfig/xen_sxpr.c
@@ -1523,7 +1523,7 @@ static int
 xenFormatSxprGraphicsNew(virDomainGraphicsDefPtr def,
                          virBufferPtr buf)
 {
-    virDomainGraphicsListenDefPtr listen;
+    virDomainGraphicsListenDefPtr gListen;
 
     if (def->type != VIR_DOMAIN_GRAPHICS_TYPE_SDL &&
         def->type != VIR_DOMAIN_GRAPHICS_TYPE_VNC) {
@@ -1551,9 +1551,9 @@ xenFormatSxprGraphicsNew(virDomainGraphicsDefPtr def,
             virBufferAsprintf(buf, "(vncdisplay %d)", def->data.vnc.port-5900);
         }
 
-        if ((listen = virDomainGraphicsGetListen(def, 0)) &&
-            listen->address)
-            virBufferAsprintf(buf, "(vnclisten '%s')", listen->address);
+        if ((gListen = virDomainGraphicsGetListen(def, 0)) &&
+            gListen->address)
+            virBufferAsprintf(buf, "(vnclisten '%s')", gListen->address);
         if (def->data.vnc.auth.passwd)
             virBufferAsprintf(buf, "(vncpasswd '%s')", def->data.vnc.auth.passwd);
         if (def->data.vnc.keymap)
@@ -1579,7 +1579,7 @@ xenFormatSxprGraphicsNew(virDomainGraphicsDefPtr def,
 static int
 xenFormatSxprGraphicsOld(virDomainGraphicsDefPtr def, virBufferPtr buf)
 {
-    virDomainGraphicsListenDefPtr listen;
+    virDomainGraphicsListenDefPtr gListen;
 
     if (def->type != VIR_DOMAIN_GRAPHICS_TYPE_SDL &&
         def->type != VIR_DOMAIN_GRAPHICS_TYPE_VNC) {
@@ -1604,9 +1604,9 @@ xenFormatSxprGraphicsOld(virDomainGraphicsDefPtr def, virBufferPtr buf)
             virBufferAsprintf(buf, "(vncdisplay %d)", def->data.vnc.port-5900);
         }
 
-        if ((listen = virDomainGraphicsGetListen(def, 0)) &&
-            listen->address)
-            virBufferAsprintf(buf, "(vnclisten '%s')", listen->address);
+        if ((gListen = virDomainGraphicsGetListen(def, 0)) &&
+            gListen->address)
+            virBufferAsprintf(buf, "(vnclisten '%s')", gListen->address);
         if (def->data.vnc.auth.passwd)
             virBufferAsprintf(buf, "(vncpasswd '%s')", def->data.vnc.auth.passwd);
         if (def->data.vnc.keymap)
diff --git a/src/xenconfig/xen_xl.c b/src/xenconfig/xen_xl.c
index b72e255..b5d4da1 100644
--- a/src/xenconfig/xen_xl.c
+++ b/src/xenconfig/xen_xl.c
@@ -837,7 +837,7 @@ xenFormatXLDomainDisks(virConfPtr conf, virDomainDefPtr def)
 static int
 xenFormatXLSpice(virConfPtr conf, virDomainDefPtr def)
 {
-    virDomainGraphicsListenDefPtr listen;
+    virDomainGraphicsListenDefPtr gListen;
     virDomainGraphicsDefPtr graphics;
 
     if (def->os.type == VIR_DOMAIN_OSTYPE_HVM) {
@@ -854,9 +854,9 @@ xenFormatXLSpice(virConfPtr conf, virDomainDefPtr def)
             if (xenConfigSetInt(conf, "spice", 1) < 0)
                 return -1;
 
-            if ((listen = virDomainGraphicsGetListen(graphics, 0)) &&
-                listen->address &&
-                xenConfigSetString(conf, "spicehost", listen->address) < 0)
+            if ((gListen = virDomainGraphicsGetListen(graphics, 0)) &&
+                gListen->address &&
+                xenConfigSetString(conf, "spicehost", gListen->address) < 0)
                 return -1;
 
             if (xenConfigSetInt(conf, "spiceport",
-- 
2.8.1

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]