diff options
author | Jeremy Huddleston <jeremyhu@apple.com> | 2011-05-08 16:08:29 -0700 |
---|---|---|
committer | Jeremy Huddleston <jeremyhu@apple.com> | 2011-05-23 19:36:02 -0700 |
commit | 48f87d48fb7b51535534ef2fb18d2fd1e451c2b5 (patch) | |
tree | 6fab8da9dab9b69b490a925e52535c7904ae55fa /process.c | |
parent | 5032c286df16737277c9a04e1083171ffec89000 (diff) | |
download | xorg-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.c | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -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, |