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

Re: [libvirt PATCH 3/5] rpc: socket: properly call virSetCloseExec



On Tue, Sep 22, 2020 at 11:32:31PM +0200, Ján Tomko wrote:
> cppcheck reports:
> style: Argument 'fd<0' to function virSetCloseExec is always 0 [knownArgument]
> 
> Signed-off-by: Ján Tomko <jtomko redhat com>
> Fixes: 4b9919af4024a6fbc3d4ee996d8a4c27dbc44285
> ---
>  src/rpc/virnetsocket.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/rpc/virnetsocket.c b/src/rpc/virnetsocket.c
> index ebdeadc4a0..f79a638775 100644
> --- a/src/rpc/virnetsocket.c
> +++ b/src/rpc/virnetsocket.c
> @@ -1388,7 +1388,7 @@ int virNetSocketDupFD(virNetSocketPtr sock, bool cloexec)
>      }
>  #ifndef F_DUPFD_CLOEXEC
>      if (cloexec &&
> -        virSetCloseExec(fd < 0)) {
> +        virSetCloseExec(fd) < 0) {

Ewww, so IIUC we were setting  close-exec on fd 0 every time here. Lucky
it didn't do anything worse.

Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|


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