diff options
author | Rob Landley <rob@landley.net> | 2006-03-20 02:20:18 +0000 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2006-03-20 02:20:18 +0000 |
commit | c30f445b08e811ec7e339e7efad8f7cd47c3ad59 (patch) | |
tree | 88e48af8fb5f079fe002fead407d5042815cfa86 | |
parent | e2b428cbb1fcbb71d56cdf6e5f640d11a2523c33 (diff) | |
download | busybox-w32-c30f445b08e811ec7e339e7efad8f7cd47c3ad59.tar.gz busybox-w32-c30f445b08e811ec7e339e7efad8f7cd47c3ad59.tar.bz2 busybox-w32-c30f445b08e811ec7e339e7efad8f7cd47c3ad59.zip |
Patch from tito, acked by Bernhard Fischer.
-rw-r--r-- | util-linux/Config.in | 10 | ||||
-rw-r--r-- | util-linux/setarch.c | 15 |
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 | ||
357 | config CONFIG_LINUX32 | ||
358 | default n | ||
359 | depends on CONFIG_SETARCH | ||
360 | |||
361 | config CONFIG_LINUX64 | ||
362 | default n | ||
363 | depends on CONFIG_SETARCH | ||
364 | |||
357 | config CONFIG_SETARCH | 365 | config 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 | ||
19 | int setarch_main(int argc, char **argv) | 19 | int 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 | */ |
28 | retry: | 28 | retry: |
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 | ||
51 | failure: | ||
52 | bb_perror_msg_and_die("%s", argv[0]); | 51 | bb_perror_msg_and_die("%s", argv[0]); |
53 | } | 52 | } |