Skip to content

Commit d504170

Browse files
committed
squash! tools: update ESLint to 7.22.0
Try using syscall instead of sys/capability.h
1 parent 42a1166 commit d504170

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/node_credentials.cc

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010

1111
#if !defined(_MSC_VER)
1212
#include <unistd.h> // setuid, getuid
13-
#include <sys/capability.h>
13+
#include <linux/capability.h>
14+
#include <sys/syscall.h>
1415
#endif
1516

1617
namespace node {
@@ -44,7 +45,7 @@ bool HasCapability(int capability) {
4445
};
4546
struct __user_cap_data_struct cap_data;
4647

47-
if (capget(&cap_header_data, &cap_data) == -1) {
48+
if (syscall(SYS_capget, &cap_header_data, &cap_data) == -1) {
4849
return false;
4950
}
5051

@@ -58,8 +59,8 @@ bool HasCapability(int capability) {
5859
// then lookup will not be allowed.
5960
bool SafeGetenv(const char* key, std::string* text, Environment* env) {
6061
#if !defined(__CloudABI__) && !defined(_WIN32)
61-
if (!HasCapability(CAP_NET_BIND_SERVICE) && per_process::linux_at_secure ||
62-
getuid() != geteuid() || getgid() != getegid())
62+
if (!HasCapability(CAP_NET_BIND_SERVICE) && (per_process::linux_at_secure ||
63+
getuid() != geteuid() || getgid() != getegid()))
6364
goto fail;
6465
#endif
6566

0 commit comments

Comments
 (0)