Skip to content

Commit b10022f

Browse files
committed
Only close PipeFDs when they do not equal -1
1 parent e7e2ea3 commit b10022f

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

llvm/lib/Support/raw_socket_stream.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -245,8 +245,10 @@ ListeningSocket::~ListeningSocket() {
245245
// Close the pipe's FDs in the destructor instead of within
246246
// ListeningSocket::shutdown to avoid unnecessary synchronization issues that
247247
// would occur as PipeFD's values would have to be changed to -1
248-
::close(PipeFD[0]);
249-
::close(PipeFD[1]);
248+
if (PipeFD[0] != -1)
249+
::close(PipeFD[0]);
250+
if (PipeFD[1] != -1)
251+
::close(PipeFD[1]);
250252
}
251253

252254
//===----------------------------------------------------------------------===//

0 commit comments

Comments
 (0)