init: change exec parsing to make SECLABEL optional
(cherry pick from commit 17fff893c04971b519d25d52b07f51111353cba5)
Allow SECLABEL to be - to denote default
Change-Id: I58cdc6c805dc6e50dc42b7e13e72d0eaf4864f11
diff --git a/init/init_parser.cpp b/init/init_parser.cpp
index d36995d..385b37b 100644
--- a/init/init_parser.cpp
+++ b/init/init_parser.cpp
@@ -666,6 +666,7 @@
service* make_exec_oneshot_service(int nargs, char** args) {
// Parse the arguments: exec [SECLABEL [UID [GID]*] --] COMMAND ARGS...
+ // SECLABEL can be a - to denote default
int command_arg = 1;
for (int i = 1; i < nargs; ++i) {
if (strcmp(args[i], "--") == 0) {
@@ -691,7 +692,7 @@
return NULL;
}
- if (command_arg > 2) {
+ if ((command_arg > 2) && strcmp(args[1], "-")) {
svc->seclabel = args[1];
}
if (command_arg > 3) {