On some file systems (like AFP), hard links are not supported. If
link fails, try rename() before giving up.

Reported-by: Jamie Kennea <ja...@pompey.org>
Signed-off-by: Jeremy Huddleston <jerem...@apple.com>
---
 process.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/process.c b/process.c
index 04abc33..a4021c7 100644
--- a/process.c
+++ b/process.c
@@ -888,7 +888,8 @@ auth_finalize(void)
 #if defined(WIN32) || defined(__UNIXOS2__)
                if (rename(temp_name, xauth_filename) == -1)
 #else
-               if (link (temp_name, xauth_filename) == -1)
+               /* 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,
-- 
1.7.4.4


_______________________________________________
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

Reply via email to