URL:
https://github.com/SSSD/sssd/pull/898
Author: alexey-tikhonov
Title: #898: util/server: amended close_low_fds()
Action: opened
PR body:
"""
Rewrote close_low_fds() to use freopen() as it fits better here
and some flags passed to open() previously didn't make a sense.
Also fixed a number of identical Coverity issues:
```
Error: RESOURCE_LEAK (CWE-772):
sssd-2.2.3/src/util/server.c:58: open_fn: Returning handle opened by "open".
[Note: The source code implementation of the function has been overridden by a user
model.]
sssd-2.2.3/src/util/server.c:58: var_assign: Assigning: "fd" = handle returned
from "open("/dev/null", 1, 0)".
sssd-2.2.3/src/util/server.c:56: overwrite_var: Overwriting handle "fd" in
"fd = open("/dev/null", 2, 0)" leaks the handle.
54| library routines writing to stdout etc. won't cause havoc */
55| for (i = 0; i < 3; i++) {
56|-> fd = open("/dev/null", O_RDWR, 0);
57| if (fd < 0)
58| fd = open("/dev/null", O_WRONLY, 0);
```
"""
To pull the PR as Git branch:
git remote add ghsssd
https://github.com/SSSD/sssd
git fetch ghsssd pull/898/head:pr898
git checkout pr898