| 1 | etiago: Backported this from fornwall's patch. |
| 2 | |
| 3 | Without this patch functions such as process.getgroups |
| 4 | are not built on Android, which breaks things such as |
| 5 | npm/node_modules/which/which.js. |
| 6 | |
| 7 | diff -u -r ../node-v4.4.3/src/node.cc ./src/node.cc > src-node.cc.patch |
| 8 | --- ../node-v4.4.3/src/node.cc 2016-04-12 19:42:14.000000000 +0000 |
| 9 | +++ ./src/node.cc 2016-04-19 07:42:50.984256666 +0000 |
| 10 | @@ -74,7 +74,7 @@ |
| 11 | #include <unistd.h> // setuid, getuid |
| 12 | #endif |
| 13 | |
| 14 | -#if defined(__POSIX__) && !defined(__ANDROID__) |
| 15 | +#if defined(__POSIX__) |
| 16 | #include <pwd.h> // getpwnam() |
| 17 | #include <grp.h> // getgrnam() |
| 18 | #endif |
| 19 | @@ -1718,7 +1718,7 @@ |
| 20 | } |
| 21 | |
| 22 | |
| 23 | -#if defined(__POSIX__) && !defined(__ANDROID__) |
| 24 | +#if defined(__POSIX__) |
| 25 | |
| 26 | static const uid_t uid_not_found = static_cast<uid_t>(-1); |
| 27 | static const gid_t gid_not_found = static_cast<gid_t>(-1); |
| 28 | @@ -2038,7 +2038,7 @@ |
| 29 | } |
| 30 | } |
| 31 | |
| 32 | -#endif // __POSIX__ && !defined(__ANDROID__) |
| 33 | +#endif // __POSIX__ |
| 34 | |
| 35 | |
| 36 | void Exit(const FunctionCallbackInfo<Value>& args) { |
| 37 | @@ -3028,7 +3028,7 @@ |
| 38 | |
| 39 | env->SetMethod(process, "umask", Umask); |
| 40 | |
| 41 | -#if defined(__POSIX__) && !defined(__ANDROID__) |
| 42 | +#if defined(__POSIX__) |
| 43 | env->SetMethod(process, "getuid", GetUid); |
| 44 | env->SetMethod(process, "geteuid", GetEUid); |
| 45 | env->SetMethod(process, "setuid", SetUid); |
| 46 | @@ -3042,7 +3042,7 @@ |
| 47 | env->SetMethod(process, "getgroups", GetGroups); |
| 48 | env->SetMethod(process, "setgroups", SetGroups); |
| 49 | env->SetMethod(process, "initgroups", InitGroups); |
| 50 | -#endif // __POSIX__ && !defined(__ANDROID__) |
| 51 | +#endif // __POSIX__ |
| 52 | |
| 53 | env->SetMethod(process, "_kill", Kill); |
| 54 | |