Github user jpeach commented on the pull request:
https://github.com/apache/trafficserver/pull/568#issuecomment-209663459
OK the locking makes sense to me I think. You have to hold the lock because
you want to serialize WRT printing output.
``Diags::rebind_stderr`` and ``Diags::rebind_stdout`` don't need to be part
of the class interface. You can replace both of these with a single local
static helper:
```C
bool rebind(int oldfd, int newfd) {
/* ... error handling ... */
return dup2(newfd, oldfd) == 0;
}
```
Please write unit tests for this.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---