termux-packages/x11-packages/xorg-xauth/xauth-1.0.10_process.c.patch
Leonid Pliushch 5ec27d5cdc
xorg-xauth: don't use link(2)
Fixes this (in kernel log):

 <36>[11541.952845] type=1400 audit(1538521396.943:198): avc: denied { link } for pid=11593 comm="xauth"
 name=".Xauthority-n" dev="dm-0" ino=123147 scontext=u:r:untrusted_app_27:s0:c512,c768
 tcontext=u:object_r:app_data_file:s0:c512,c768 tclass=file permissive=0
2022-04-18 14:08:22 +05:30

21 lines
844 B
Diff

diff -uNr xauth-1.0.10/process.c xauth-1.0.10.mod/process.c
--- xauth-1.0.10/process.c 2017-01-29 23:00:12.000000000 +0200
+++ xauth-1.0.10.mod/process.c 2018-10-03 02:07:13.062110327 +0300
@@ -891,15 +891,10 @@
ProgramName, temp_name);
} else {
(void) unlink (xauth_filename);
-#if defined(WIN32) || defined(__UNIXOS2__)
if (rename(temp_name, xauth_filename) == -1)
-#else
- /* Attempt to rename() if link() fails, since this may be on a FS that does not support hard links */
- if (link (temp_name, xauth_filename) == -1 && rename(temp_name, xauth_filename) == -1)
-#endif
{
fprintf (stderr,
- "%s: unable to link authority file %s, use %s\n",
+ "%s: unable to link/rename authority file %s, use %s\n",
ProgramName, xauth_filename, temp_name);
} else {
(void) unlink (temp_name);