commit c789dbac2f1f72c0eff66e7965cc55fc36113b39 from: Stefan Sperling date: Mon Mar 11 15:26:28 2019 UTC fix bug in got_lockfile_lock() where it never succeeded commit - 58908ed09b094dbcf8c976c0a726b76f0ff2cae5 commit + c789dbac2f1f72c0eff66e7965cc55fc36113b39 blob - 2ea32dfb79258128985f28ea721c9b5757888284 blob + 5fb38e763b15fc0db4b035e8dbc8e53b16e194b1 --- lib/lockfile.c +++ lib/lockfile.c @@ -55,13 +55,13 @@ got_lockfile_lock(struct got_lockfile **lf, const char do { (*lf)->fd = open((*lf)->path, flags, GOT_DEFAULT_FILE_MODE); - if ((*lf)->fd == -1) { - if (errno != EEXIST) { - err = got_error_from_errno(); - goto done; - } - sleep(1); + if ((*lf)->fd != -1) + break; + if (errno != EEXIST) { + err = got_error_from_errno(); + goto done; } + sleep(1); } while (--attempts > 0); if ((*lf)->fd == -1)