diff options
-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 @@ | |||
34 | # include <malloc.h> /* for mallopt */ | 34 | # include <malloc.h> /* for mallopt */ |
35 | #endif | 35 | #endif |
36 | 36 | ||
37 | #include <sys/prctl.h> | ||
38 | #ifndef PR_SET_NAME | ||
39 | #define PR_SET_NAME 15 | ||
40 | #endif | ||
41 | #ifndef PR_GET_NAME | ||
42 | #define PR_GET_NAME 16 | ||
43 | #endif | ||
37 | 44 | ||
38 | /* Declare <applet>_main() */ | 45 | /* Declare <applet>_main() */ |
39 | #define PROTOTYPES | 46 | #define PROTOTYPES |
@@ -1056,6 +1063,17 @@ int main(int argc UNUSED_PARAM, char **argv) | |||
1056 | if (applet_name[0] == '-') | 1063 | if (applet_name[0] == '-') |
1057 | applet_name++; | 1064 | applet_name++; |
1058 | applet_name = bb_basename(applet_name); | 1065 | applet_name = bb_basename(applet_name); |
1066 | |||
1067 | # if defined(__linux__) | ||
1068 | /* If we are a result of execv("/proc/self/exe"), fix ugly comm of "exe" */ | ||
1069 | if (ENABLE_FEATURE_SH_STANDALONE | ||
1070 | || ENABLE_FEATURE_PREFER_APPLETS | ||
1071 | || !BB_MMU | ||
1072 | ) { | ||
1073 | prctl(PR_SET_NAME, (long)applet_name, 0, 0, 0); | ||
1074 | } | ||
1075 | # endif | ||
1076 | |||
1059 | parse_config_file(); /* ...maybe, if FEATURE_SUID_CONFIG */ | 1077 | parse_config_file(); /* ...maybe, if FEATURE_SUID_CONFIG */ |
1060 | run_applet_and_exit(applet_name, argv); | 1078 | run_applet_and_exit(applet_name, argv); |
1061 | 1079 | ||