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

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

cron2 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 2:

(2 comments)

File src/compat/close-fds.c:

http://gerrit.openvpn.net/c/openvpn/+/1881/comment/7bc3ef82_ca4ebbb3?usp=email :
PS2, Line 42:         const int lower_closed = keep == 3 || close_range(3, (unsigned int)keep - 1, 0) == 0;
> This should probably be `bool` instead.
... and please avoid complex conditional operator constructs with side effects in assignments.  I only had two coffees today and I find this line beyond my C parsing skills right now.

This looks like we're calling `close_range()` way too often anyway - figure out the lower boundary in an understandable `if()` clause (or a conditional assignment), then call `close_range( first, last, 0 )`.


http://gerrit.openvpn.net/c/openvpn/+/1881/comment/bb033b37_333e2356?usp=email :
PS2, Line 63:             close((int)i);
if we cast the to-be-closed file descriptor to `(int)` here, using `long` as a loop index is not the right thing to do.



-- 
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: 2
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: plaisthos <[email protected]>
Gerrit-Attention: srkyn <[email protected]>
Gerrit-Comment-Date: Sat, 29 Aug 2026 16:37:49 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: razvanc <[email protected]>

_______________________________________________
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.