X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=src%2Fthread%2Fsem_open.c;h=9a95d257172096f6bd933005adb1299bbecf00c9;hb=3df0b66ee95c837496ae434ba7a2282d97ca71ef;hp=66f12ee42000450e5b26ef56b51f11b61ad835ab;hpb=a033cd22aa0ecd9f494b74669d358e7e1c7e1335;p=musl diff --git a/src/thread/sem_open.c b/src/thread/sem_open.c index 66f12ee4..9a95d257 100644 --- a/src/thread/sem_open.c +++ b/src/thread/sem_open.c @@ -123,9 +123,9 @@ sem_t *sem_open(const char *name, int flags, ...) goto fail; } close(fd); - if (link(tmp, name) == 0) break; - e = errno; + e = link(tmp, name) ? errno : 0; unlink(tmp); + if (!e) break; /* Failure is only fatal when doing an exclusive open; * otherwise, next iteration will try to open the * existing file. */