]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
msgr: avoid closing fd twice
authorSage Weil <sage@newdream.net>
Fri, 31 Jul 2009 22:45:18 +0000 (15:45 -0700)
committerSage Weil <sage@newdream.net>
Fri, 31 Jul 2009 23:09:01 +0000 (16:09 -0700)
Set fd to -1 after so we don't close it again later.  Otherwise
we get EBADF in random other places and are unhappy.

src/msg/SimpleMessenger.cc

index 7b8e8ca811f51930d383536c9072ae30dcad621a..03327183531cae650dea30191beadf8aa3d7cdf6 100644 (file)
@@ -1146,8 +1146,10 @@ void SimpleMessenger::Pipe::stop()
   dout(10) << "stop" << dendl;
   state = STATE_CLOSED;
   cond.Signal();
-  if (sd >= 0)
+  if (sd >= 0) {
     ::close(sd);
+    sd = -1;
+  }
   if (reader_running)
     reader_thread.kill(SIGUSR2);
   if (writer_running)