libbase: realpath is wrapped with TEMP_FAILURE_RETRY
Although man page for realpath doesn't say so, the bionic implementation of realpath may exit with error code EINTR. In such cases, retry. Test: boots (sanity) Change-Id: Ic5feb7152374a81bd2f475ad74c4bc8c3afb3a20
This commit is contained in:
parent
26328e80b1
commit
5f4cb8a240
|
@ -385,7 +385,12 @@ bool Readlink(const std::string& path, std::string* result) {
|
|||
bool Realpath(const std::string& path, std::string* result) {
|
||||
result->clear();
|
||||
|
||||
char* realpath_buf = realpath(path.c_str(), nullptr);
|
||||
// realpath may exit with EINTR. Retry if so.
|
||||
char* realpath_buf = nullptr;
|
||||
do {
|
||||
realpath_buf = realpath(path.c_str(), nullptr);
|
||||
} while (realpath_buf == nullptr && errno == EINTR);
|
||||
|
||||
if (realpath_buf == nullptr) {
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue