Re: [PATCH 1/3] rpc: avoid double close on error

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

 



On 08/02/2011 12:12 PM, Eric Blake wrote:
Spotted by coverity.  If pipe2 fails, then we attempt to close
uninitialized fds, which may result in a double-close.

* src/rpc/virnetserver.c (virNetServerSignalSetup): Initialize fds.
---
  src/rpc/virnetserver.c |    2 +-
  1 file changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/rpc/virnetserver.c b/src/rpc/virnetserver.c
index 2dae2ff..4deeca1 100644
--- a/src/rpc/virnetserver.c
+++ b/src/rpc/virnetserver.c
@@ -471,7 +471,7 @@ cleanup:

  static int virNetServerSignalSetup(virNetServerPtr srv)
  {
-    int fds[2];
+    int fds[2] = { -1, -1 };

      if (srv->sigwrite != -1)
          return 0;

ACK.

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