diff options
author | Wei Wang <wvw@google.com> | 2017-02-02 10:52:39 -0800 |
---|---|---|
committer | Wei Wang <wvw@google.com> | 2017-02-03 10:40:39 -0800 |
commit | 2d0fdaaafc5d2925b8ef7708a950f6b599892b54 (patch) | |
tree | bda4830736d62b96c5326c70048dc8256e77c847 /init/builtins.cpp | |
parent | d85cf0fb7ded4001ae5a342d058dfa5e2e272eab (diff) |
init: clean up exec command
Add wait time log for exec service execution time
Fix memory leak when exec service failed to start
Test: on marlin
Bug: 34518530
Change-Id: I01736bd9b1429414f3dc91dd5d02d88a681f0985
Diffstat (limited to 'init/builtins.cpp')
-rw-r--r-- | init/builtins.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/init/builtins.cpp b/init/builtins.cpp index 965a81fbe..2388edcf7 100644 --- a/init/builtins.cpp +++ b/init/builtins.cpp @@ -265,10 +265,14 @@ static int do_exec(const std::vector<std::string>& args) { if (!svc) { return -1; } + if (!start_waiting_for_exec()) { + return -1; + } if (!svc->Start()) { + stop_waiting_for_exec(); + ServiceManager::GetInstance().RemoveService(*svc); return -1; } - waiting_for_exec = true; return 0; } @@ -1018,7 +1022,7 @@ static int do_wait_for_prop(const std::vector<std::string>& args) { << "\") failed: value too long"; return -1; } - if (!wait_property(name, value)) { + if (!start_waiting_for_property(name, value)) { LOG(ERROR) << "do_wait_for_prop(\"" << name << "\", \"" << value << "\") failed: init already in waiting"; return -1; |