init/service.cpp: fix access check for console
Commit 9596d2b9 changes how availability of console is checked by only checking access bits for the console device. However, in cases where there is no console it defaults to /dev/console. This device is always enumerated by tty driver (i.e. file and access bits may be correct), but it doesn't always map to an underlying console driver. Because the lookup for the underlying console driver happens during the open system call, checking only the access bits is not sufficient and need to make sure open system call is successful, we can safely close the FD afterwards to avoid FD leaks. Test: boot device and check console svc doesn't continuously restart Bug: 33691649 Change-Id: Ia51a8a2f56c345b70db55e95f61a057a98b52895
Loading
Please register or sign in to comment