[libvirt] [PATCH] util: fix build on RHEL 6

Eric Blake posted 1 patch 7 years ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/20170327131528.7727-1-eblake@redhat.com
src/util/virstoragefile.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
[libvirt] [PATCH] util: fix build on RHEL 6
Posted by Eric Blake 7 years ago
We keep forgetting that older setups don't like 'index':

  CC     util/libvirt_util_la-virsysinfo.lo
cc1: warnings being treated as errors
util/virstoragefile.c: In function 'virStorageSourceFindByNodeName':
util/virstoragefile.c:3804: error: declaration of 'index' shadows a global declaration [-Wshadow]
/usr/include/string.h:489: error: shadowed declaration is here [-Wshadow]

Signed-off-by: Eric Blake <eblake@redhat.com>
---

Pushing under the build-breaker rule

 src/util/virstoragefile.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c
index 0ac7079..22cdb83 100644
--- a/src/util/virstoragefile.c
+++ b/src/util/virstoragefile.c
@@ -1,7 +1,7 @@
 /*
  * virstoragefile.c: file utility functions for FS storage backend
  *
- * Copyright (C) 2007-2014, 2016 Red Hat, Inc.
+ * Copyright (C) 2007-2017 Red Hat, Inc.
  * Copyright (C) 2007-2008 Daniel P. Berrange
  *
  * This library is free software; you can redistribute it and/or
@@ -3801,23 +3801,23 @@ virStorageSourceIsRelative(virStorageSourcePtr src)
 virStorageSourcePtr
 virStorageSourceFindByNodeName(virStorageSourcePtr top,
                                const char *nodeName,
-                               unsigned int *index)
+                               unsigned int *idx)
 {
     virStorageSourcePtr tmp;

-    if (index)
-        *index = 0;
+    if (idx)
+        *idx = 0;

     for (tmp = top; tmp; tmp = tmp->backingStore) {
         if ((tmp->nodeformat && STREQ(tmp->nodeformat, nodeName)) ||
             (tmp->nodebacking && STREQ(tmp->nodebacking, nodeName)))
             return tmp;

-        if (index)
-            (*index)++;
+        if (idx)
+            (*idx)++;
     }

-    if (index)
-        *index = 0;
+    if (idx)
+        *idx = 0;
     return NULL;
 }
-- 
2.9.3

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