mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-25 20:33:08 +00:00
Fix building on Android by avoiding getpwent() (#3441)
* Fix building on Android by avoiding getpwent() if missing with autoconf check The getpwent() function does not link when building for Android, and user names on that platform are not interesting anyway.
This commit is contained in:
parent
44baf0f9bd
commit
fe8727fb71
2 changed files with 9 additions and 0 deletions
|
@ -302,6 +302,7 @@ AC_CHECK_FUNCS( futimes )
|
||||||
AC_CHECK_FUNCS( wcslcpy lrand48_r killpg )
|
AC_CHECK_FUNCS( wcslcpy lrand48_r killpg )
|
||||||
AC_CHECK_FUNCS( backtrace_symbols getifaddrs )
|
AC_CHECK_FUNCS( backtrace_symbols getifaddrs )
|
||||||
AC_CHECK_FUNCS( futimens clock_gettime )
|
AC_CHECK_FUNCS( futimens clock_gettime )
|
||||||
|
AC_CHECK_FUNCS( getpwent )
|
||||||
|
|
||||||
AC_CHECK_DECL( [mkostemp], [ AC_CHECK_FUNCS([mkostemp]) ] )
|
AC_CHECK_DECL( [mkostemp], [ AC_CHECK_FUNCS([mkostemp]) ] )
|
||||||
|
|
||||||
|
|
|
@ -1187,6 +1187,13 @@ bool completer_t::try_complete_variable(const wcstring &str) {
|
||||||
///
|
///
|
||||||
/// \return 0 if unable to complete, 1 otherwise
|
/// \return 0 if unable to complete, 1 otherwise
|
||||||
bool completer_t::try_complete_user(const wcstring &str) {
|
bool completer_t::try_complete_user(const wcstring &str) {
|
||||||
|
#ifndef HAVE_GETPWENT
|
||||||
|
// The getpwent() function does not exist on Android. A Linux user on Android isn't
|
||||||
|
// really a user - each installed app gets an UID assigned. Listing all UID:s is not
|
||||||
|
// possible without root access, and doing a ~USER type expansion does not make sense
|
||||||
|
// since every app is sandboxed and can't access eachother.
|
||||||
|
return false;
|
||||||
|
#else
|
||||||
const wchar_t *cmd = str.c_str();
|
const wchar_t *cmd = str.c_str();
|
||||||
const wchar_t *first_char = cmd;
|
const wchar_t *first_char = cmd;
|
||||||
int res = 0;
|
int res = 0;
|
||||||
|
@ -1233,6 +1240,7 @@ bool completer_t::try_complete_user(const wcstring &str) {
|
||||||
}
|
}
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void complete(const wcstring &cmd_with_subcmds, std::vector<completion_t> *out_comps,
|
void complete(const wcstring &cmd_with_subcmds, std::vector<completion_t> *out_comps,
|
||||||
|
|
Loading…
Reference in a new issue