termux-packages/x11-packages/libxau/libXau-1.0.8_AuLock.c.patch

38 lines
1.1 KiB
Diff

diff -uNr libXau-1.0.8/AuLock.c libXau-1.0.8.mod/AuLock.c
--- libXau-1.0.8/AuLock.c 2013-05-25 01:04:09.000000000 +0300
+++ libXau-1.0.8.mod/AuLock.c 2018-10-02 15:43:48.634507315 +0300
@@ -79,27 +79,12 @@
(void) close (creat_fd);
}
if (creat_fd != -1) {
-#ifdef HAVE_PATHCONF
- /* 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;
- }
+ // Android disallows link(2), so forcing rename(2) here.
+ if (rename(creat_name, link_name) != -1) {
+ return LOCK_SUCCESS;
+ } else {
+ return LOCK_ERROR;
+ }
}
(void) sleep ((unsigned) timeout);
--retries;