init: fix undefined behavior in ExecuteCommand am: d67a4abc64 am: 279f3d593f am: 737d0f5265
am: 86e7b8c3c8

Change-Id: I9c844355f3b35722abf62dd9d164af5eac815ea9
diff --git a/init/action.cpp b/init/action.cpp
index e9b2a0d..acbb12e 100644
--- a/init/action.cpp
+++ b/init/action.cpp
@@ -105,7 +105,10 @@
 }
 
 void Action::ExecuteOneCommand(std::size_t command) const {
-    ExecuteCommand(commands_[command]);
+    // We need a copy here since some Command execution may result in
+    // changing commands_ vector by importing .rc files through parser
+    Command cmd = commands_[command];
+    ExecuteCommand(cmd);
 }
 
 void Action::ExecuteAllCommands() const {
diff --git a/init/builtins.cpp b/init/builtins.cpp
index de75438..4774df8 100644
--- a/init/builtins.cpp
+++ b/init/builtins.cpp
@@ -594,9 +594,9 @@
 
     for (na = args.size() - 1; na > 1; --na) {
         if (args[na] == "--early") {
-             path_arg_end = na;
-             queue_event = false;
-             mount_mode = MOUNT_MODE_EARLY;
+            path_arg_end = na;
+            queue_event = false;
+            mount_mode = MOUNT_MODE_EARLY;
         } else if (args[na] == "--late") {
             path_arg_end = na;
             import_rc = false;