diff --git a/src/node_credentials.cc b/src/node_credentials.cc index 8be27925844307..5f177590d3aaa2 100644 --- a/src/node_credentials.cc +++ b/src/node_credentials.cc @@ -10,7 +10,8 @@ #if !defined(_MSC_VER) #include // setuid, getuid -#include +#include +#include #endif namespace node { @@ -44,7 +45,7 @@ bool HasCapability(int capability) { }; struct __user_cap_data_struct cap_data; - if (capget(&cap_header_data, &cap_data) == -1) { + if (syscall(SYS_capget, &cap_header_data, &cap_data) == -1) { return false; } @@ -58,8 +59,8 @@ bool HasCapability(int capability) { // then lookup will not be allowed. bool SafeGetenv(const char* key, std::string* text, Environment* env) { #if !defined(__CloudABI__) && !defined(_WIN32) - if (!HasCapability(CAP_NET_BIND_SERVICE) && per_process::linux_at_secure || - getuid() != geteuid() || getgid() != getegid()) + if (!HasCapability(CAP_NET_BIND_SERVICE) && (per_process::linux_at_secure || + getuid() != geteuid() || getgid() != getegid())) goto fail; #endif