Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5f4cb8a2 authored by Yifan Hong's avatar Yifan Hong
Browse files

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
parent 26328e80
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -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;
  }