diff options
author | Billy Donahue <billy.donahue@mongodb.com> | 2021-02-09 03:22:39 -0500 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2021-02-11 09:20:51 +0000 |
commit | 8e94afbf3a1f6ae97b1a1b94d0db90ae71b511ca (patch) | |
tree | c9b30d5beaa47417e1263e7eaa55a15997fd432c /src/mongo/unittest | |
parent | e437a595bbf0575d005ebbac7c5071583c6e1ec0 (diff) | |
download | mongo-8e94afbf3a1f6ae97b1a1b94d0db90ae71b511ca.tar.gz |
SERVER-54412 DEATH_TEST must tolerate EINTR from getline
Diffstat (limited to 'src/mongo/unittest')
-rw-r--r-- | src/mongo/unittest/death_test.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/mongo/unittest/death_test.cpp b/src/mongo/unittest/death_test.cpp index 31f98f37f9e..0afe8800d09 100644 --- a/src/mongo/unittest/death_test.cpp +++ b/src/mongo/unittest/death_test.cpp @@ -129,8 +129,14 @@ void DeathTestBase::_doTest() { char* lineBuf = nullptr; size_t lineBufSize = 0; auto lineBufGuard = makeGuard([&] { free(lineBuf); }); - ssize_t bytesRead; - while ((bytesRead = getline(&lineBuf, &lineBufSize, pf)) != -1) { + while (true) { + errno = 0; // Needed as getline can return -1 without setting errno. + ssize_t bytesRead = getline(&lineBuf, &lineBufSize, pf); + if (bytesRead == -1) { + if (errno == EINTR) + continue; + break; + } StringData line(lineBuf, bytesRead); if (line.empty()) continue; |