projects
/
oweals
/
busybox.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fix recognitions of -SIGname signals
[oweals/busybox.git]
/
libbb
/
run_shell.c
diff --git
a/libbb/run_shell.c
b/libbb/run_shell.c
index 67ff2a5f82566d5ec818c14178a5fe48d93b8479..6be09088d76d5308fbbc337b81b672e57d4db25b 100644
(file)
--- a/
libbb/run_shell.c
+++ b/
libbb/run_shell.c
@@
-41,27
+41,21
@@
#endif
#ifdef CONFIG_SELINUX
#endif
#ifdef CONFIG_SELINUX
-static security_context_t current_sid
=NULL
;
+static security_context_t current_sid;
void
renew_current_security_context(void)
{
void
renew_current_security_context(void)
{
- if (current_sid)
- freecon(current_sid); /* Release old context */
-
- getcon(¤t_sid); /* update */
-
- return;
+ if (current_sid)
+ freecon(current_sid); /* Release old context */
+ getcon(¤t_sid); /* update */
}
void
set_current_security_context(security_context_t sid)
{
}
void
set_current_security_context(security_context_t sid)
{
- if (current_sid)
- freecon(current_sid); /* Release old context */
-
- current_sid=sid;
-
- return;
+ if (current_sid)
+ freecon(current_sid); /* Release old context */
+ current_sid = sid;
}
#endif
}
#endif
@@
-71,40
+65,37
@@
set_current_security_context(security_context_t sid)
If ADDITIONAL_ARGS is nonzero, pass it to the shell as more
arguments. */
If ADDITIONAL_ARGS is nonzero, pass it to the shell as more
arguments. */
-void run_shell
(
const char *shell, int loginshell, const char *command, const char **additional_args)
+void run_shell
(
const char *shell, int loginshell, const char *command, const char **additional_args)
{
const char **args;
int argno = 1;
int additional_args_cnt = 0;
{
const char **args;
int argno = 1;
int additional_args_cnt = 0;
- for (
args = additional_args; args && *args; args++
)
+ for (
args = additional_args; args && *args; args++
)
additional_args_cnt++;
additional_args_cnt++;
-
args = (const char **) xmalloc (sizeof (char *) * ( 4 + additional_args_cnt
));
+
args = xmalloc(sizeof(char*) * (4 + additional_args_cnt
));
- args
[0] = bb_get_last_path_component ( bb_xstrdup ( shell
));
+ args
[0] = bb_get_last_path_component(xstrdup(shell
));
- if ( loginshell ) {
- char *args0;
- bb_xasprintf ( &args0, "-%s", args [0] );
- args [0] = args0;
- }
+ if (loginshell)
+ args[0] = xasprintf("-%s", args[0]);
- if (
command
) {
- args
[argno++] = "-c";
- args
[argno++] = command;
+ if (
command
) {
+ args[argno++] = "-c";
+ args[argno++] = command;
}
}
- if (
additional_args
) {
- for (
; *additional_args; ++additional_args
)
- args
[argno++] = *additional_args;
+ if (
additional_args
) {
+ for (
; *additional_args; ++additional_args
)
+ args[argno++] = *additional_args;
}
}
- args
[argno] = 0
;
+ args
[argno] = NULL
;
#ifdef CONFIG_SELINUX
#ifdef CONFIG_SELINUX
- if (
(current_sid) && (!setexeccon(current_sid))
) {
- freecon(current_sid);
- execve(shell, (char **) args, environ);
+ if (
current_sid && !setexeccon(current_sid)
) {
+
freecon(current_sid);
+
execve(shell, (char **) args, environ);
} else
#endif
} else
#endif
-
execv ( shell, (char **) args
);
- bb_perror_msg_and_die
( "cannot run %s", shell
);
+
execv(shell, (char **) args
);
+ bb_perror_msg_and_die
("cannot run %s", shell
);
}
}