]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
lscpu: fix variable shadowing
authorSami Kerola <kerolasa@iki.fi>
Thu, 26 Nov 2020 16:54:50 +0000 (16:54 +0000)
committerSami Kerola <kerolasa@iki.fi>
Mon, 28 Dec 2020 09:53:12 +0000 (09:53 +0000)
    sys-utils/lscpu-virt.c: In function ‘lscpu_read_virtualization’:
    sys-utils/lscpu-virt.c:574:9: warning: declaration of ‘buf’ shadows a previous local [-Wshadow]
      574 |    char buf[256];
          |         ^~~
    sys-utils/lscpu-virt.c:506:7: note: shadowed declaration is here
      506 |  char buf[BUFSIZ];
          |       ^~~

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
sys-utils/lscpu-virt.c

index 9b61eb6f84e3234c335cf0cc9664e005314fb0f7..60324b670967272757baa37fd39949bf744cfb0f 100644 (file)
@@ -571,10 +571,10 @@ struct lscpu_virt *lscpu_read_virtualization(struct lscpu_cxt *cxt)
 
                fd = ul_path_fopen(cxt->procfs, "r", "xen/capabilities");
                if (fd) {
-                       char buf[256];
+                       char xenbuf[256];
 
-                       if (fscanf(fd, "%255s", buf) == 1 &&
-                           !strcmp(buf, "control_d"))
+                       if (fscanf(fd, "%255s", xenbuf) == 1 &&
+                           !strcmp(xenbuf, "control_d"))
                                dom0 = 1;
                        fclose(fd);
                }