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

Commit 604e7544 authored by Thierry Strudel's avatar Thierry Strudel Committed by Android Git Automerger
Browse files

am 91cf41cf: init: wait_for_file use smaller time resolution

* commit '91cf41cf':
  init: wait_for_file use smaller time resolution
parents ffdac6dd 91cf41cf
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -367,10 +367,10 @@ void remove_link(const char *oldpath, const char *newpath)
int wait_for_file(const char *filename, int timeout)
{
    struct stat info;
    time_t timeout_time = gettime() + timeout;
    uint64_t timeout_time_ns = gettime_ns() + timeout * UINT64_C(1000000000);
    int ret = -1;

    while (gettime() < timeout_time && ((ret = stat(filename, &info)) < 0))
    while (gettime_ns() < timeout_time_ns && ((ret = stat(filename, &info)) < 0))
        usleep(10000);

    return ret;