From: xie xingguo Date: Tue, 19 Jul 2016 07:29:29 +0000 (+0800) Subject: msg/simple: fix wrong condition checking of writing TAG_CLOSE on closing X-Git-Tag: ses5-milestone5~289^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F10343%2Fhead;p=ceph.git msg/simple: fix wrong condition checking of writing TAG_CLOSE on closing The sd is initialized to -1 and will be resetted to -1 whenever it is invalidated. So "if (sd)" is not reasonable enough to determine whether or not the sd is currently still in use. Signed-off-by: xie xingguo --- diff --git a/src/msg/simple/Pipe.cc b/src/msg/simple/Pipe.cc index 2c2efb097f7..835868a3685 100644 --- a/src/msg/simple/Pipe.cc +++ b/src/msg/simple/Pipe.cc @@ -887,7 +887,7 @@ int Pipe::connect() __u32 cseq = connect_seq; __u32 gseq = msgr->get_global_seq(); - // stop reader thrad + // stop reader thread join_reader(); pipe_lock.Unlock(); @@ -1736,7 +1736,7 @@ void Pipe::writer() state = STATE_CLOSED; state_closed.set(1); pipe_lock.Unlock(); - if (sd) { + if (sd >= 0) { // we can ignore return value, actually; we don't care if this succeeds. int r = ::write(sd, &tag, 1); (void)r;