summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Huddleston <jeremyhu@apple.com>2011-05-23 19:37:50 -0700
committerJeremy Huddleston <jeremyhu@apple.com>2011-05-23 19:40:53 -0700
commitc791ec2ba9614e661e978436f56ed21f918750f8 (patch)
tree9ea28f1d29e144327cdfa1180c90a3abfdfbccf9
parent90640776b88b32cea2316670a3b29f7785aadc7a (diff)
downloadiceauth-c791ec2ba9614e661e978436f56ed21f918750f8.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>
-rw-r--r--process.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/process.c b/process.c
index 56b7aaf..1a104b1 100644
--- a/process.c
+++ b/process.c
@@ -700,7 +700,8 @@ int auth_finalize (void)
#if defined(WIN32) || defined(__UNIXOS2__)
if (rename(temp_name, iceauth_filename) == -1)
#else
- if (link (temp_name, iceauth_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, iceauth_filename) == -1 && rename(temp_name, iceauth_filename) == -1)
#endif
{
fprintf (stderr,