Re: [PATCH] virCommand: Cleanup unnecessarily variables

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

 



On Sun, May 22, 2011 at 04:42:09PM +0200, Michal Privoznik wrote:
> ---
> Building with ENABLE_DEBUG=0 showed more errors,
> because VIR_DEBUG() get replaced with dummy 'do {} while(0)' statement,
> and compiler complains about unused parameters. So if anybody knows
> how to get rid of this ... Note that I am speaking about '...' part in
> VIR_DEBUG_INT() definition.
> 
>  src/util/command.c |    9 +++------
>  1 files changed, 3 insertions(+), 6 deletions(-)
> 
> diff --git a/src/util/command.c b/src/util/command.c
> index ebb90cb..4b8a940 100644
> --- a/src/util/command.c
> +++ b/src/util/command.c
> @@ -962,9 +962,8 @@ virCommandProcessIO(virCommandPtr cmd)
>                  } else {
>                      inoff += done;
>                      if (inoff == inlen) {
> -                        int tmpfd = infd;
>                          if (VIR_CLOSE(infd) < 0)
> -                            VIR_DEBUG("ignoring failed close on fd %d", tmpfd);
> +                            VIR_DEBUG("ignoring failed close on fd %d", infd);
>                      }
>                  }
>              }
> @@ -1145,17 +1144,15 @@ virCommandRun(virCommandPtr cmd, int *exitstatus)
>              VIR_DEBUG("ignoring failed close on fd %d", tmpfd);
>      }
>      if (cmd->outbuf == &outbuf) {
> -        int tmpfd = cmd->outfd;
>          if (VIR_CLOSE(cmd->outfd) < 0)
> -            VIR_DEBUG("ignoring failed close on fd %d", tmpfd);
> +            VIR_DEBUG("ignoring failed close on fd %d", cmd->outfd);
>          cmd->outfdptr = NULL;
>          cmd->outbuf = NULL;
>          VIR_FREE(outbuf);
>      }
>      if (cmd->errbuf == &errbuf) {
> -        int tmpfd = cmd->errfd;
>          if (VIR_CLOSE(cmd->errfd) < 0)
> -            VIR_DEBUG("ignoring failed close on fd %d", tmpfd);
> +            VIR_DEBUG("ignoring failed close on fd %d", cmd->errfd);
>          cmd->errfdptr = NULL;
>          cmd->errbuf = NULL;
>          VIR_FREE(errbuf);

Anything which wants to ignore the return status of VIR_CLOSE and not
report an error, should be using  VIR_FORCE_CLOSE instead.

Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|

--
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]