[PATCH] qemu: Rename @main variable in qemuDomainRemoveLogs()

Michal Privoznik posted 1 patch 2 years ago
Test syntax-check passed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/7901385998f18a32cac233cf3356600ba25e369e.1649232715.git.mprivozn@redhat.com
src/qemu/qemu_domain.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
[PATCH] qemu: Rename @main variable in qemuDomainRemoveLogs()
Posted by Michal Privoznik 2 years ago
Older GCC fails to understand that 'char *main' is a variable and
not main() function. Rename the variable to appease old GCC.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
---
 src/qemu/qemu_domain.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index c35e5c09a3..a4334de158 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -11828,7 +11828,7 @@ qemuDomainRemoveLogs(virQEMUDriver *driver,
 {
     g_autoptr(virQEMUDriverConfig) cfg = NULL;
     g_autofree char *format = NULL;
-    g_autofree char *main = NULL;
+    g_autofree char *main_log = NULL;
     g_autoptr(DIR) dir = NULL;
     struct dirent *entry;
     int rc;
@@ -11840,13 +11840,13 @@ qemuDomainRemoveLogs(virQEMUDriver *driver,
     if (virDirOpen(&dir, cfg->logDir) < 0)
         return -1;
 
-    main = g_strdup_printf("%s.log", name);
+    main_log = g_strdup_printf("%s.log", name);
     format = g_strdup_printf("%s.log.%%u", name);
 
     while ((rc = virDirRead(dir, &entry, cfg->logDir)) > 0) {
         unsigned int u;
 
-        if (STREQ(entry->d_name, main) ||
+        if (STREQ(entry->d_name, main_log) ||
             sscanf(entry->d_name, format, &u) == 1) {
             g_autofree char *path = NULL;
 
-- 
2.35.1
Re: [PATCH] qemu: Rename @main variable in qemuDomainRemoveLogs()
Posted by Nikolay Shirokovskiy 2 years ago
ср, 6 апр. 2022 г. в 11:11, Michal Privoznik <mprivozn@redhat.com>:
>
> Older GCC fails to understand that 'char *main' is a variable and
> not main() function. Rename the variable to appease old GCC.
>
> Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
> ---
>  src/qemu/qemu_domain.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
> index c35e5c09a3..a4334de158 100644
> --- a/src/qemu/qemu_domain.c
> +++ b/src/qemu/qemu_domain.c
> @@ -11828,7 +11828,7 @@ qemuDomainRemoveLogs(virQEMUDriver *driver,
>  {
>      g_autoptr(virQEMUDriverConfig) cfg = NULL;
>      g_autofree char *format = NULL;
> -    g_autofree char *main = NULL;
> +    g_autofree char *main_log = NULL;
>      g_autoptr(DIR) dir = NULL;
>      struct dirent *entry;
>      int rc;
> @@ -11840,13 +11840,13 @@ qemuDomainRemoveLogs(virQEMUDriver *driver,
>      if (virDirOpen(&dir, cfg->logDir) < 0)
>          return -1;
>
> -    main = g_strdup_printf("%s.log", name);
> +    main_log = g_strdup_printf("%s.log", name);
>      format = g_strdup_printf("%s.log.%%u", name);
>
>      while ((rc = virDirRead(dir, &entry, cfg->logDir)) > 0) {
>          unsigned int u;
>
> -        if (STREQ(entry->d_name, main) ||
> +        if (STREQ(entry->d_name, main_log) ||
>              sscanf(entry->d_name, format, &u) == 1) {
>              g_autofree char *path = NULL;
>
> --
> 2.35.1
>

Reviewed-by: Nikolay Shirokovskiy <nshirokovskiy@openvz.org>

Nikolay