From d75558194ae9c9dfaa21a4e514c91ec6127016f9 Mon Sep 17 00:00:00 2001 From: vvb2060 Date: Wed, 28 Jul 2021 21:42:48 +0800 Subject: [PATCH] Fix flock -c https://android.googlesource.com/platform/bionic/+/refs/tags/android-11.0.0_r39/tests/grp_pwd_test.cpp#81 --- include/libbb.h | 4 ++-- libbb/get_shell_name.c | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/include/libbb.h b/include/libbb.h index ae94e921d..120e1c6d2 100644 --- a/include/libbb.h +++ b/include/libbb.h @@ -2265,12 +2265,12 @@ static ALWAYS_INLINE void* not_const_pp(const void *p) { return (void*)p; } * use bb_default_login_shell and following defines. * If you change LIBBB_DEFAULT_LOGIN_SHELL, * don't forget to change increment constant. */ -#define LIBBB_DEFAULT_LOGIN_SHELL "-/sbin/sh" +#define LIBBB_DEFAULT_LOGIN_SHELL "-/system/bin/sh" extern const char bb_default_login_shell[] ALIGN1; /* "/bin/sh" */ #define DEFAULT_SHELL (bb_default_login_shell+1) /* "sh" */ -#define DEFAULT_SHELL_SHORT_NAME (bb_default_login_shell+7) +#define DEFAULT_SHELL_SHORT_NAME (bb_default_login_shell+13) /* The following devices are the same on all systems. */ #define CURRENT_TTY "/dev/tty" diff --git a/libbb/get_shell_name.c b/libbb/get_shell_name.c index 5aebe9cdc..5af53bdda 100644 --- a/libbb/get_shell_name.c +++ b/libbb/get_shell_name.c @@ -17,6 +17,10 @@ const char* FAST_FUNC get_shell_name(void) if (shell && shell[0]) return shell; +#ifdef __ANDROID__ + return DEFAULT_SHELL_SHORT_NAME; +#endif + pw = getpwuid(getuid()); if (pw && pw->pw_shell && pw->pw_shell[0]) return pw->pw_shell;