aboutsummaryrefslogtreecommitdiff
path: root/util-linux/setarch.c
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2006-03-20 02:20:18 +0000
committerRob Landley <rob@landley.net>2006-03-20 02:20:18 +0000
commitc30f445b08e811ec7e339e7efad8f7cd47c3ad59 (patch)
tree88e48af8fb5f079fe002fead407d5042815cfa86 /util-linux/setarch.c
parente2b428cbb1fcbb71d56cdf6e5f640d11a2523c33 (diff)
downloadbusybox-c30f445b08e811ec7e339e7efad8f7cd47c3ad59.tar.gz
Patch from tito, acked by Bernhard Fischer.
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 @@
#include "busybox.h"
-int setarch_main(int argc, char **argv)
+int setarch_main(int ATTRIBUTE_UNUSED argc, char **argv)
{
int pers = -1;
@@ -26,9 +26,9 @@ int setarch_main(int argc, char **argv)
* argv[0] -> "personality"
*/
retry:
- if (!strcmp(argv[0], "linux64"))
+ if (argv[0][5] == '6') /* linux64 */
pers = PER_LINUX;
- else if (!strcmp(argv[0], "linux32"))
+ else if (argv[0][5] == '3') /* linux32 */
pers = PER_LINUX32;
else if (pers == -1 && argv[1] != NULL) {
pers = PER_LINUX32;
@@ -42,12 +42,11 @@ retry:
bb_show_usage();
/* Try to set personality */
- if (personality(pers) < 0)
- goto failure;
+ if (personality(pers) >= 0) {
- /* Try to execute the program */
- execvp(argv[0], argv);
+ /* Try to execute the program */
+ execvp(argv[0], argv);
+ }
-failure:
bb_perror_msg_and_die("%s", argv[0]);
}