diff options
author | marha <marha@users.sourceforge.net> | 2009-09-02 19:11:07 +0000 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2009-09-02 19:11:07 +0000 |
commit | e1580ae7d64a01efb2464cbbffb6d99cb5af1b8a (patch) | |
tree | 9f2140c9eeebb6aa89d76625bd0fb93d1cb0ba79 /libXau/AuLock.c | |
parent | 199039111284ed3a10508e2dc0db49ca4192389c (diff) | |
download | vcxsrv-e1580ae7d64a01efb2464cbbffb6d99cb5af1b8a.tar.gz vcxsrv-e1580ae7d64a01efb2464cbbffb6d99cb5af1b8a.tar.bz2 vcxsrv-e1580ae7d64a01efb2464cbbffb6d99cb5af1b8a.zip |
Switched to libXau-1.0.5.tar.gz
Diffstat (limited to 'libXau/AuLock.c')
-rw-r--r-- | libXau/AuLock.c | 30 |
1 files changed, 22 insertions, 8 deletions
diff --git a/libXau/AuLock.c b/libXau/AuLock.c index 001235607..69b1fd69a 100644 --- a/libXau/AuLock.c +++ b/libXau/AuLock.c @@ -90,14 +90,28 @@ long dead) (void) close (creat_fd); } if (creat_fd != -1) { - if (link (creat_name, link_name) != -1) - return LOCK_SUCCESS; - if (errno == ENOENT) { - creat_fd = -1; /* force re-creat next time around */ - continue; - } - if (errno != EEXIST) - return LOCK_ERROR; +#ifndef X_NOT_POSIX + /* The file system may not support hard links, and pathconf should tell us that. */ + if (1 == pathconf(creat_name, _PC_LINK_MAX)) { + if (-1 == rename(creat_name, link_name)) { + /* Is this good enough? Perhaps we should retry. TEST */ + return LOCK_ERROR; + } else { + return LOCK_SUCCESS; + } + } else { +#endif + if (link (creat_name, link_name) != -1) + return LOCK_SUCCESS; + if (errno == ENOENT) { + creat_fd = -1; /* force re-creat next time around */ + continue; + } + if (errno != EEXIST) + return LOCK_ERROR; +#ifndef X_NOT_POSIX + } +#endif } (void) sleep ((unsigned) timeout); --retries; |