mirror of
https://github.com/tmux/tmux.git
synced 2024-11-13 23:58:51 +00:00
Use lockf which is more portable than flock, from Dagobert Michelsen.
This commit is contained in:
parent
5dda1abc32
commit
d89b35e682
4
client.c
4
client.c
@ -78,8 +78,8 @@ client_get_lock(char *lockfile)
|
|||||||
if ((lockfd = open(lockfile, O_WRONLY|O_CREAT, 0600)) == -1)
|
if ((lockfd = open(lockfile, O_WRONLY|O_CREAT, 0600)) == -1)
|
||||||
fatal("open failed");
|
fatal("open failed");
|
||||||
|
|
||||||
if (flock(lockfd, LOCK_EX|LOCK_NB) == -1 && errno == EWOULDBLOCK) {
|
if (lockf(lockfd, F_TLOCK, 0) == -1 && errno == EAGAIN) {
|
||||||
while (flock(lockfd, LOCK_EX) == -1 && errno == EINTR)
|
while (lockf(lockfd, F_LOCK, 0) == -1 && errno == EINTR)
|
||||||
/* nothing */;
|
/* nothing */;
|
||||||
close(lockfd);
|
close(lockfd);
|
||||||
return (-1);
|
return (-1);
|
||||||
|
Loading…
Reference in New Issue
Block a user