loolwsd: fix PreFork test

We could have up to 3 pipes and we should tollerate them
when testing for leaking FDs and pipes.

The 3rd is probably a file redirection.

Change-Id: I913072307646e62e1802587c9142b2eb8c9dd7bb
Reviewed-on: https://gerrit.libreoffice.org/27021
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
This commit is contained in:
Ashod Nakashian 2016-07-07 14:59:51 -04:00 committed by Ashod Nakashian
parent fdebaf6070
commit 2c4efeb5f3

View file

@ -252,7 +252,7 @@ public:
assert(len<sizeof(buffer));
numSockets++;
char *extDot = strrchr(buffer, '.');
// fprintf(stdout, "fd: %s -> %s\n", ent->d_name, buffer);
Log::info() << "fd:" << ent->d_name << " -> " << buffer << Log::end;
if (!strncmp(buffer, "/dev/", sizeof ("/dev/") -1))
deviceCount++;
else if (extDot && !strcmp(extDot, ".res"))
@ -274,7 +274,8 @@ public:
}
fprintf(stderr, "%d devices, %d rdb %d resources, %d pipes, %d descriptors total: %d unexpected\n",
deviceCount, rdbCount, resCount, pipeCount, numSockets, numUnexpected);
if (pipeCount > 2 || numUnexpected > 0)
// 3 Pipes at most: 1 input, 1 output, file redirection (or so I imagine them).
if (pipeCount > 3 || numUnexpected > 0)
_failure = std::string("Error: unexpected inherited sockets ") +
std::to_string(numUnexpected) + " and pipes " +
std::to_string(pipeCount);