[L] Change in openvpn[master]: compat: close all unrelated fds in forked helpers

"razvanc \(Code Review\) via Openvpn-devel" <[email protected]>
Newsgroups gmane.network.openvpn.devel
Message-ID <00eefa6276abf97b564161fbd33fe7fa3e3086a8-EmailReviewComments-HTML@gerrit.openvpn.net>
Attention is currently required from: srkyn.

razvanc has posted comments on this change by srkyn. ( http://gerrit.openvpn.net/c/openvpn/+/1881?usp=email )

Change subject: compat: close all unrelated fds in forked helpers
......................................................................


Patch Set 3:

(3 comments)

File src/compat/close-fds.c:

http://gerrit.openvpn.net/c/openvpn/+/1881/comment/1446d86a_fd3a4d1f?usp=email :
PS3, Line 1: /*
It looks like all the other files in src/compat have a naming convention of compat-*.c and shim a missing standard function, while close-fds.c breaks both conventions.

Maybe cron2 has a suggestion on where these files best belong. At the very least, they should probably be renamed compat-close-fds.{h,c}.


http://gerrit.openvpn.net/c/openvpn/+/1881/comment/321312d5_9afa555f?usp=email :
PS3, Line 64:     }
This can probably be done in a synonymous but shorter form, i.e. something like (I haven't tested this):

```
    bool closed = true;
    unsigned int first = 3;
    if (keep >= 3)
    {
        if (keep > 3)
        {
            closed = close_range(3, (unsigned int)keep - 1, 0) == 0;
        }
        first = (unsigned int)keep + 1;
    }
    closed = close_range(first, ~0U, 0) == 0 && closed;
    if (closed)
    {
        return;
    }
```


File tests/unit_tests/openvpn/test_misc.c:

http://gerrit.openvpn.net/c/openvpn/+/1881/comment/c5ac903a_24a1ddba?usp=email :
PS3, Line 544:         if (dup2(source, 100) < 0 || dup2(source, 200) < 0)
The new tests fail when `RLIMIT_NOFILE` ≤ 200 (e.g. `ulimit -n  64` causes them to fail. A CI container with a tight `NOFILE` breaks the test suite.



-- 
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1881?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: comment
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Iacd56d245e9ab30cfb25b2b364ca661fa289dc55
Gerrit-Change-Number: 1881
Gerrit-PatchSet: 3
Gerrit-Owner: srkyn <[email protected]>
Gerrit-Reviewer: plaisthos <[email protected]>
Gerrit-Reviewer: razvanc <[email protected]>
Gerrit-CC: cron2 <[email protected]>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: srkyn <[email protected]>
Gerrit-Comment-Date: Fri, 04 Sep 2026 08:29:24 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No

_______________________________________________
Openvpn-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.