diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2017-07-29 02:19:01 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2017-07-29 02:19:01 +0200 |
commit | 147d2ce3dd98945a328ab9390dc562923b17c2f3 (patch) | |
tree | eb11f7bc5b3da0081bab45b31cb9f69bcfe3a432 | |
parent | 00a1dbd230a3e0ee2cea84130b7f20d9c9a9cf4e (diff) | |
download | busybox-147d2ce3dd98945a328ab9390dc562923b17c2f3.tar.gz |
standalone shell / prefer_applets: fix "exe" in comm fields
function old new delta
main 92 106 +14
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r-- | libbb/appletlib.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/libbb/appletlib.c b/libbb/appletlib.c index 7a1a7f005..fa28d433b 100644 --- a/libbb/appletlib.c +++ b/libbb/appletlib.c @@ -34,6 +34,13 @@ # include <malloc.h> /* for mallopt */ #endif +#include <sys/prctl.h> +#ifndef PR_SET_NAME +#define PR_SET_NAME 15 +#endif +#ifndef PR_GET_NAME +#define PR_GET_NAME 16 +#endif /* Declare <applet>_main() */ #define PROTOTYPES @@ -1056,6 +1063,17 @@ int main(int argc UNUSED_PARAM, char **argv) if (applet_name[0] == '-') applet_name++; applet_name = bb_basename(applet_name); + +# if defined(__linux__) + /* If we are a result of execv("/proc/self/exe"), fix ugly comm of "exe" */ + if (ENABLE_FEATURE_SH_STANDALONE + || ENABLE_FEATURE_PREFER_APPLETS + || !BB_MMU + ) { + prctl(PR_SET_NAME, (long)applet_name, 0, 0, 0); + } +# endif + parse_config_file(); /* ...maybe, if FEATURE_SUID_CONFIG */ run_applet_and_exit(applet_name, argv); |