libxau: use rename(2) instead of symlink(2) when locking
This commit is contained in:
parent
3faa2eeb0c
commit
a840313ee9
@ -3,7 +3,7 @@ TERMUX_PKG_MAINTAINER="Leonid Plyushch <leonid.plyushch@gmail.com> @xeffyr"
|
|||||||
TERMUX_PKG_HOMEPAGE=https://xorg.freedesktop.org/
|
TERMUX_PKG_HOMEPAGE=https://xorg.freedesktop.org/
|
||||||
TERMUX_PKG_DESCRIPTION="X11 authorisation library"
|
TERMUX_PKG_DESCRIPTION="X11 authorisation library"
|
||||||
TERMUX_PKG_VERSION=1.0.8
|
TERMUX_PKG_VERSION=1.0.8
|
||||||
TERMUX_PKG_REVISION=4
|
TERMUX_PKG_REVISION=5
|
||||||
TERMUX_PKG_SRCURL=https://xorg.freedesktop.org/releases/individual/lib/libXau-${TERMUX_PKG_VERSION}.tar.bz2
|
TERMUX_PKG_SRCURL=https://xorg.freedesktop.org/releases/individual/lib/libXau-${TERMUX_PKG_VERSION}.tar.bz2
|
||||||
TERMUX_PKG_SHA256=fdd477320aeb5cdd67272838722d6b7d544887dfe7de46e1e7cc0c27c2bea4f2
|
TERMUX_PKG_SHA256=fdd477320aeb5cdd67272838722d6b7d544887dfe7de46e1e7cc0c27c2bea4f2
|
||||||
TERMUX_PKG_BUILD_DEPENDS="xorgproto"
|
TERMUX_PKG_BUILD_DEPENDS="xorgproto"
|
||||||
|
@ -1,12 +1,37 @@
|
|||||||
diff -uNr libXau-1.0.8/AuLock.c libXau-1.0.8.mod/AuLock.c
|
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/AuLock.c 2013-05-25 01:04:09.000000000 +0300
|
||||||
+++ libXau-1.0.8.mod/AuLock.c 2017-11-23 14:08:52.004479977 +0200
|
+++ libXau-1.0.8.mod/AuLock.c 2018-10-02 15:43:48.634507315 +0300
|
||||||
@@ -91,7 +91,7 @@
|
@@ -79,27 +79,12 @@
|
||||||
} else
|
(void) close (creat_fd);
|
||||||
#endif
|
}
|
||||||
{
|
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)
|
- if (link (creat_name, link_name) != -1)
|
||||||
+ if (symlink (creat_name, link_name) != -1)
|
- return LOCK_SUCCESS;
|
||||||
return LOCK_SUCCESS;
|
- if (errno == ENOENT) {
|
||||||
if (errno == ENOENT) {
|
- creat_fd = -1; /* force re-creat next time around */
|
||||||
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;
|
||||||
|
Loading…
Reference in New Issue
Block a user