aboutsummaryrefslogtreecommitdiff
path: root/util-linux/setarch.c
diff options
context:
space:
mode:
Diffstat (limited to 'util-linux/setarch.c')
-rw-r--r--util-linux/setarch.c15
1 files changed, 7 insertions, 8 deletions
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}