summaryrefslogtreecommitdiff
path: root/process.c
diff options
context:
space:
mode:
authorJeremy Huddleston <jeremyhu@apple.com>2011-05-08 16:08:29 -0700
committerJeremy Huddleston <jeremyhu@apple.com>2011-05-23 19:36:02 -0700
commit48f87d48fb7b51535534ef2fb18d2fd1e451c2b5 (patch)
tree6fab8da9dab9b69b490a925e52535c7904ae55fa /process.c
parent5032c286df16737277c9a04e1083171ffec89000 (diff)
downloadxorg-app-xauth-48f87d48fb7b51535534ef2fb18d2fd1e451c2b5.tar.gz
auth_finalize: Attempt to rename() if link() fails
On some file systems (like AFP), hard links are not supported. If link fails, try rename() before giving up. Reported-by: Jamie Kennea <jamie@pompey.org> Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
Diffstat (limited to 'process.c')
-rw-r--r--process.c3
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,