svn commit: trunk/busybox/libbb

vda at busybox.net vda at busybox.net
Tue Sep 5 09:45:30 UTC 2006


Author: vda
Date: 2006-09-05 02:45:30 -0700 (Tue, 05 Sep 2006)
New Revision: 16053

Log:
run_shell.c: style fix



Modified:
   trunk/busybox/libbb/run_shell.c


Changeset:
Modified: trunk/busybox/libbb/run_shell.c
===================================================================
--- trunk/busybox/libbb/run_shell.c	2006-09-05 09:36:19 UTC (rev 16052)
+++ trunk/busybox/libbb/run_shell.c	2006-09-05 09:45:30 UTC (rev 16053)
@@ -41,27 +41,21 @@
 #endif
 
 #ifdef CONFIG_SELINUX
-static security_context_t current_sid=NULL;
+static security_context_t current_sid;
 
 void
 renew_current_security_context(void)
 {
-  if  (current_sid)
-    freecon(current_sid);  /* Release old context  */
-
-  getcon(&current_sid);  /* update */
-
-  return;
+	if (current_sid)
+		freecon(current_sid);  /* Release old context  */
+	getcon(&current_sid);  /* update */
 }
 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
@@ -71,37 +65,37 @@
    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;
 
-	for ( args = additional_args; args && *args; args++ )
+	for (args = additional_args; args && *args; args++)
 		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 ( xstrdup ( shell ));
+	args[0] = bb_get_last_path_component(xstrdup(shell));
 
-	if ( loginshell )
-		args [0] = xasprintf ("-%s", args [0]);
+	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
-	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
-	  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);
 }




More information about the busybox-cvs mailing list