aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--util-linux/Config.in10
-rw-r--r--util-linux/setarch.c15
2 files changed, 17 insertions, 8 deletions
diff --git a/util-linux/Config.in b/util-linux/Config.in
index 28292bd40..b91eb69c7 100644
--- a/util-linux/Config.in
+++ b/util-linux/Config.in
@@ -354,9 +354,19 @@ config CONFIG_READPROFILE
354 help 354 help
355 This allows you to parse /proc/profile for basic profiling. 355 This allows you to parse /proc/profile for basic profiling.
356 356
357config CONFIG_LINUX32
358 default n
359 depends on CONFIG_SETARCH
360
361config CONFIG_LINUX64
362 default n
363 depends on CONFIG_SETARCH
364
357config CONFIG_SETARCH 365config CONFIG_SETARCH
358 bool "setarch" 366 bool "setarch"
359 default n 367 default n
368 select CONFIG_LINUX32
369 select CONFIG_LINUX64
360 help 370 help
361 The linux32 utility is used to create a 32bit environment for the 371 The linux32 utility is used to create a 32bit environment for the
362 specified program (usually a shell). It only makes sense to have 372 specified program (usually a shell). It only makes sense to have
diff --git a/util-linux/setarch.c b/util-linux/setarch.c
index 33588e4ee..d7e1c0917 100644
--- a/util-linux/setarch.c
+++ b/util-linux/setarch.c
@@ -16,7 +16,7 @@
16 16
17#include "busybox.h" 17#include "busybox.h"
18 18
19int setarch_main(int argc, char **argv) 19int setarch_main(int ATTRIBUTE_UNUSED argc, char **argv)
20{ 20{
21 int pers = -1; 21 int pers = -1;
22 22
@@ -26,9 +26,9 @@ int setarch_main(int argc, char **argv)
26 * argv[0] -> "personality" 26 * argv[0] -> "personality"
27 */ 27 */
28retry: 28retry:
29 if (!strcmp(argv[0], "linux64")) 29 if (argv[0][5] == '6') /* linux64 */
30 pers = PER_LINUX; 30 pers = PER_LINUX;
31 else if (!strcmp(argv[0], "linux32")) 31 else if (argv[0][5] == '3') /* linux32 */
32 pers = PER_LINUX32; 32 pers = PER_LINUX32;
33 else if (pers == -1 && argv[1] != NULL) { 33 else if (pers == -1 && argv[1] != NULL) {
34 pers = PER_LINUX32; 34 pers = PER_LINUX32;
@@ -42,12 +42,11 @@ retry:
42 bb_show_usage(); 42 bb_show_usage();
43 43
44 /* Try to set personality */ 44 /* Try to set personality */
45 if (personality(pers) < 0) 45 if (personality(pers) >= 0) {
46 goto failure;
47 46
48 /* Try to execute the program */ 47 /* Try to execute the program */
49 execvp(argv[0], argv); 48 execvp(argv[0], argv);
49 }
50 50
51failure:
52 bb_perror_msg_and_die("%s", argv[0]); 51 bb_perror_msg_and_die("%s", argv[0]);
53} 52}