@@ -1687,23 +1687,21 @@ static const char* name_by_gid(gid_t gid) {
1687
1687
#endif
1688
1688
1689
1689
1690
- static uid_t uid_by_name (Handle <Value> value) {
1690
+ static uid_t uid_by_name (Isolate* isolate, Handle <Value> value) {
1691
1691
if (value->IsUint32 ()) {
1692
1692
return static_cast <uid_t >(value->Uint32Value ());
1693
1693
} else {
1694
- // TODO(trevnorris): Fix to not use GetCurrent().
1695
- node::Utf8Value name (Isolate::GetCurrent (), value);
1694
+ node::Utf8Value name (isolate, value);
1696
1695
return uid_by_name (*name);
1697
1696
}
1698
1697
}
1699
1698
1700
1699
1701
- static gid_t gid_by_name (Handle <Value> value) {
1700
+ static gid_t gid_by_name (Isolate* isolate, Handle <Value> value) {
1702
1701
if (value->IsUint32 ()) {
1703
1702
return static_cast <gid_t >(value->Uint32Value ());
1704
1703
} else {
1705
- // TODO(trevnorris): Fix to not use GetCurrent().
1706
- node::Utf8Value name (Isolate::GetCurrent (), value);
1704
+ node::Utf8Value name (isolate, value);
1707
1705
return gid_by_name (*name);
1708
1706
}
1709
1707
}
@@ -1728,7 +1726,7 @@ static void SetGid(const FunctionCallbackInfo<Value>& args) {
1728
1726
return env->ThrowTypeError (" setgid argument must be a number or a string" );
1729
1727
}
1730
1728
1731
- gid_t gid = gid_by_name (args[0 ]);
1729
+ gid_t gid = gid_by_name (env-> isolate (), args[0 ]);
1732
1730
1733
1731
if (gid == gid_not_found) {
1734
1732
return env->ThrowError (" setgid group id does not exist" );
@@ -1747,7 +1745,7 @@ static void SetUid(const FunctionCallbackInfo<Value>& args) {
1747
1745
return env->ThrowTypeError (" setuid argument must be a number or a string" );
1748
1746
}
1749
1747
1750
- uid_t uid = uid_by_name (args[0 ]);
1748
+ uid_t uid = uid_by_name (env-> isolate (), args[0 ]);
1751
1749
1752
1750
if (uid == uid_not_found) {
1753
1751
return env->ThrowError (" setuid user id does not exist" );
@@ -1809,7 +1807,7 @@ static void SetGroups(const FunctionCallbackInfo<Value>& args) {
1809
1807
gid_t * groups = new gid_t [size];
1810
1808
1811
1809
for (size_t i = 0 ; i < size; i++) {
1812
- gid_t gid = gid_by_name (groups_list->Get (i));
1810
+ gid_t gid = gid_by_name (env-> isolate (), groups_list->Get (i));
1813
1811
1814
1812
if (gid == gid_not_found) {
1815
1813
delete[] groups;
@@ -1856,7 +1854,7 @@ static void InitGroups(const FunctionCallbackInfo<Value>& args) {
1856
1854
return env->ThrowError (" initgroups user not found" );
1857
1855
}
1858
1856
1859
- extra_group = gid_by_name (args[1 ]);
1857
+ extra_group = gid_by_name (env-> isolate (), args[1 ]);
1860
1858
1861
1859
if (extra_group == gid_not_found) {
1862
1860
if (must_free)
0 commit comments