Changeset 2725 in MondoRescue for branches/2.2.9/mindi-busybox/util-linux/setarch.c
- Timestamp:
- Feb 25, 2011, 9:26:54 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.2.9/mindi-busybox/util-linux/setarch.c
r1765 r2725 1 1 /* vi: set sw=4 ts=4: */ 2 2 /* 3 * Linux32/linux64 allows for changing uname emulation.3 * linux32/linux64 allows for changing uname emulation. 4 4 * 5 5 * Copyright 2002 Andi Kleen, SuSE Labs. 6 6 * 7 * Licensed under GPL v2 or later, see file License for details.7 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 8 8 */ 9 9 … … 12 12 #include "libbb.h" 13 13 14 int setarch_main(int ATTRIBUTE_UNUSED argc, char **argv);15 int setarch_main(int ATTRIBUTE_UNUSED argc, char **argv)14 int setarch_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; 15 int setarch_main(int argc UNUSED_PARAM, char **argv) 16 16 { 17 int pers = -1;17 int pers; 18 18 19 19 /* Figure out what personality we are supposed to switch to ... 20 20 * we can be invoked as either: 21 * argv[0],argv[1] ->"setarch","personality"22 * argv[0] ->"personality"21 * argv[0],argv[1] == "setarch","personality" 22 * argv[0] == "personality" 23 23 */ 24 retry: 25 if (argv[0][5] == '6') /* linux64 */ 24 if (ENABLE_SETARCH && applet_name[0] == 's' 25 && argv[1] && strncpy(argv[1], "linux", 5) 26 ) { 27 applet_name = argv[1]; 28 argv++; 29 } 30 if (applet_name[5] == '6') /* linux64 */ 26 31 pers = PER_LINUX; 27 else if (a rgv[0][5] == '3') /* linux32 */32 else if (applet_name[5] == '3') /* linux32 */ 28 33 pers = PER_LINUX32; 29 else if (pers == -1 && argv[1] != NULL) { 30 pers = PER_LINUX32; 31 ++argv; 32 goto retry; 33 } 34 else 35 bb_show_usage(); 34 36 35 /* make user actually gave us something to do */ 36 ++argv; 37 argv++; 37 38 if (argv[0] == NULL) 38 39 bb_show_usage(); … … 40 41 /* Try to set personality */ 41 42 if (personality(pers) >= 0) { 42 43 43 /* Try to execute the program */ 44 44 BB_EXECVP(argv[0], argv); 45 45 } 46 46 47 bb_ perror_msg_and_die("%s",argv[0]);47 bb_simple_perror_msg_and_die(argv[0]); 48 48 }
Note:
See TracChangeset
for help on using the changeset viewer.