aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2006-09-05 09:45:30 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2006-09-05 09:45:30 +0000
commit797b4d210d3a877f51be404aa1b147246dd3f079 (patch)
tree19c811ad144cf56350df698653c0a38a0f3c471b
parentd25a2645f5273e70616abe73e6ac1adda5016532 (diff)
downloadbusybox-w32-797b4d210d3a877f51be404aa1b147246dd3f079.tar.gz
busybox-w32-797b4d210d3a877f51be404aa1b147246dd3f079.tar.bz2
busybox-w32-797b4d210d3a877f51be404aa1b147246dd3f079.zip
run_shell.c: style fix
-rw-r--r--libbb/run_shell.c56
1 files changed, 25 insertions, 31 deletions
diff --git a/libbb/run_shell.c b/libbb/run_shell.c
index 86cb0b056..6be09088d 100644
--- a/libbb/run_shell.c
+++ b/libbb/run_shell.c
@@ -41,27 +41,21 @@
41#endif 41#endif
42 42
43#ifdef CONFIG_SELINUX 43#ifdef CONFIG_SELINUX
44static security_context_t current_sid=NULL; 44static security_context_t current_sid;
45 45
46void 46void
47renew_current_security_context(void) 47renew_current_security_context(void)
48{ 48{
49 if (current_sid) 49 if (current_sid)
50 freecon(current_sid); /* Release old context */ 50 freecon(current_sid); /* Release old context */
51 51 getcon(&current_sid); /* update */
52 getcon(&current_sid); /* update */
53
54 return;
55} 52}
56void 53void
57set_current_security_context(security_context_t sid) 54set_current_security_context(security_context_t sid)
58{ 55{
59 if (current_sid) 56 if (current_sid)
60 freecon(current_sid); /* Release old context */ 57 freecon(current_sid); /* Release old context */
61 58 current_sid = sid;
62 current_sid=sid;
63
64 return;
65} 59}
66 60
67#endif 61#endif
@@ -71,37 +65,37 @@ set_current_security_context(security_context_t sid)
71 If ADDITIONAL_ARGS is nonzero, pass it to the shell as more 65 If ADDITIONAL_ARGS is nonzero, pass it to the shell as more
72 arguments. */ 66 arguments. */
73 67
74void run_shell ( const char *shell, int loginshell, const char *command, const char **additional_args) 68void run_shell(const char *shell, int loginshell, const char *command, const char **additional_args)
75{ 69{
76 const char **args; 70 const char **args;
77 int argno = 1; 71 int argno = 1;
78 int additional_args_cnt = 0; 72 int additional_args_cnt = 0;
79 73
80 for ( args = additional_args; args && *args; args++ ) 74 for (args = additional_args; args && *args; args++)
81 additional_args_cnt++; 75 additional_args_cnt++;
82 76
83 args = (const char **) xmalloc (sizeof (char *) * ( 4 + additional_args_cnt )); 77 args = xmalloc(sizeof(char*) * (4 + additional_args_cnt));
84 78
85 args [0] = bb_get_last_path_component ( xstrdup ( shell )); 79 args[0] = bb_get_last_path_component(xstrdup(shell));
86 80
87 if ( loginshell ) 81 if (loginshell)
88 args [0] = xasprintf ("-%s", args [0]); 82 args[0] = xasprintf("-%s", args[0]);
89 83
90 if ( command ) { 84 if (command) {
91 args [argno++] = "-c"; 85 args[argno++] = "-c";
92 args [argno++] = command; 86 args[argno++] = command;
93 } 87 }
94 if ( additional_args ) { 88 if (additional_args) {
95 for ( ; *additional_args; ++additional_args ) 89 for (; *additional_args; ++additional_args)
96 args [argno++] = *additional_args; 90 args[argno++] = *additional_args;
97 } 91 }
98 args [argno] = 0; 92 args[argno] = NULL;
99#ifdef CONFIG_SELINUX 93#ifdef CONFIG_SELINUX
100 if ( (current_sid) && (!setexeccon(current_sid)) ) { 94 if (current_sid && !setexeccon(current_sid)) {
101 freecon(current_sid); 95 freecon(current_sid);
102 execve(shell, (char **) args, environ); 96 execve(shell, (char **) args, environ);
103 } else 97 } else
104#endif 98#endif
105 execv ( shell, (char **) args ); 99 execv(shell, (char **) args);
106 bb_perror_msg_and_die ( "cannot run %s", shell ); 100 bb_perror_msg_and_die("cannot run %s", shell);
107} 101}