Skip to content

Commit db2ace1

Browse files
KrayzeeKevtargos
authored andcommitted
test: assume priv ports start at 1024 if it can't be changed
An update to test/parallel/test-cluster-bind-privileged-port.js checks the lowest privileged port to ensure 42 is privileged This only works on kernels > 4.1. On older kernels, this is locked at 1024 so the check is not needed. Fixes: #45838 PR-URL: #46536 Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
1 parent fb1ac98 commit db2ace1

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

test/parallel/test-cluster-bind-privileged-port.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,14 @@ const net = require('net');
2727
const { readFileSync } = require('fs');
2828

2929
if (common.isLinux) {
30-
const unprivilegedPortStart = parseInt(readFileSync('/proc/sys/net/ipv4/ip_unprivileged_port_start'));
31-
if (unprivilegedPortStart <= 42) {
32-
common.skip('Port 42 is unprivileged');
30+
try {
31+
const unprivilegedPortStart = parseInt(readFileSync('/proc/sys/net/ipv4/ip_unprivileged_port_start'));
32+
if (unprivilegedPortStart <= 42) {
33+
common.skip('Port 42 is unprivileged');
34+
}
35+
} catch {
36+
// Do nothing, feature doesn't exist, minimum is 1024 so 42 is usable.
37+
// Continue...
3338
}
3439
}
3540

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy