Merge "init/service.cpp: fix FD leak for services with consoles"
am: 4173d9b57c
Change-Id: Iaf8e2857ccb425cc7a41f286f5353c76333cba9d
This commit is contained in:
commit
869ce5d40a
1 changed files with 2 additions and 2 deletions
|
|
@ -567,9 +567,9 @@ bool Service::Start() {
|
||||||
console_ = default_console;
|
console_ = default_console;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool have_console = (open(console_.c_str(), O_RDWR | O_CLOEXEC) != -1);
|
bool have_console = (access(console_.c_str(), R_OK | W_OK) != -1);
|
||||||
if (!have_console) {
|
if (!have_console) {
|
||||||
PLOG(ERROR) << "service '" << name_ << "' couldn't open console '" << console_ << "'";
|
PLOG(ERROR) << "service '" << name_ << "' cannot gain read/write access to console '" << console_ << "'";
|
||||||
flags_ |= SVC_DISABLED;
|
flags_ |= SVC_DISABLED;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue