src/libxl/libxl_driver.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
Using a variable named 'stat' clashes with the system function
'stat()' causing compiler warnings on some platforms:
libxl/libxl_driver.c: In function 'libxlDomainBlockStatsVBD':
libxl/libxl_driver.c:5387: error: declaration of 'stat' shadows a global declaration [-Wshadow]
/usr/include/sys/stat.h:455: error: shadowed declaration is here [-Wshadow]
Signed-off-by: George Dunlap <george.dunlap@citrix.com>
---
CC: Daniel P. Berrange <berrange@redhat.com>
CC: Jim Fehlig <jfehlig@suse.com>
CC: xen-devel@xenproject.org
CC: libvir-list@redhat.com
---
src/libxl/libxl_driver.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
index c261e2155..4c7775358 100644
--- a/src/libxl/libxl_driver.c
+++ b/src/libxl/libxl_driver.c
@@ -5374,7 +5374,7 @@ libxlDomainBlockStatsVBD(virDomainObjPtr vm,
int devno = libxlDiskPathToID(dev);
int size;
char *path, *name, *val;
- unsigned long long stat;
+ unsigned long long status;
path = name = val = NULL;
if (devno < 0) {
@@ -5401,12 +5401,12 @@ libxlDomainBlockStatsVBD(virDomainObjPtr vm,
# define LIBXL_SET_VBDSTAT(FIELD, VAR, MUL) \
if ((virAsprintf(&name, "%s/"FIELD, path) < 0) || \
(virFileReadAll(name, 256, &val) < 0) || \
- (sscanf(val, "%llu", &stat) != 1)) { \
+ (sscanf(val, "%llu", &status) != 1)) { \
virReportError(VIR_ERR_OPERATION_FAILED, \
_("cannot read %s"), name); \
goto cleanup; \
} \
- VAR += (stat * MUL); \
+ VAR += (status * MUL); \
VIR_FREE(name); \
VIR_FREE(val);
--
2.14.1
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
On Thu, 2017-08-24 at 12:34 +0100, George Dunlap wrote:
> @@ -5401,12 +5401,12 @@ libxlDomainBlockStatsVBD(virDomainObjPtr vm,
> # define LIBXL_SET_VBDSTAT(FIELD, VAR, MUL) \
> if ((virAsprintf(&name, "%s/"FIELD, path) < 0) || \
> (virFileReadAll(name, 256, &val) < 0) || \
> - (sscanf(val, "%llu", &stat) != 1)) { \
> + (sscanf(val, "%llu", &status) != 1)) { \
You messed up the alignment here...
> virReportError(VIR_ERR_OPERATION_FAILED, \
> _("cannot read %s"), name); \
> goto cleanup; \
> } \
> - VAR += (stat * MUL); \
> + VAR += (status * MUL); \
... and here. I've fixed it up before pushing.
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
--
Andrea Bolognani / Red Hat / Virtualization
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
> On Aug 24, 2017, at 3:24 PM, Andrea Bolognani <abologna@redhat.com> wrote:
>
> On Thu, 2017-08-24 at 12:34 +0100, George Dunlap wrote:
>> @@ -5401,12 +5401,12 @@ libxlDomainBlockStatsVBD(virDomainObjPtr vm,
>> # define LIBXL_SET_VBDSTAT(FIELD, VAR, MUL) \
>> if ((virAsprintf(&name, "%s/"FIELD, path) < 0) || \
>> (virFileReadAll(name, 256, &val) < 0) || \
>> - (sscanf(val, "%llu", &stat) != 1)) { \
>> + (sscanf(val, "%llu", &status) != 1)) { \
>
> You messed up the alignment here...
>
>> virReportError(VIR_ERR_OPERATION_FAILED, \
>> _("cannot read %s"), name); \
>> goto cleanup; \
>> } \
>> - VAR += (stat * MUL); \
>> + VAR += (status * MUL); \
>
> ... and here. I've fixed it up before pushing.
Yes, I noticed that after sending it. Thanks for fixing it up.
-George
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
© 2016 - 2026 Red Hat, Inc.