← Commit list

147d2ce3d

Denys Vlasenko
Denys Vlasenko
2017-07-29
SUCCESS Duration: 142s

Subject

standalone shell / prefer_applets: fix "exe" in comm fields

Binary

No binary (build failed)

Architecture & Compiler Flags

Architecture: x86_64-linux-gnu Compiler: gcc (Ubuntu 11.4.0-1ubuntu1~22.04.3) 11.4.0

—

Build Log

(log yok)

Commit Diff GitHub →

libbb/appletlib.c+18 -0
@@ -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);