From bd795255aaeeed9bf1be74c5dcad1cb0f3466d67 Mon Sep 17 00:00:00 2001 From: Asanka Herath Date: Tue, 24 Aug 2010 00:00:16 -0400 Subject: [PATCH] Fix fcc_remove_cred() on platforms with non-standard rename() --- lib/krb5/fcache.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/krb5/fcache.c b/lib/krb5/fcache.c index 85c95bd5e..1e6397427 100644 --- a/lib/krb5/fcache.c +++ b/lib/krb5/fcache.c @@ -814,6 +814,14 @@ fcc_remove_cred(krb5_context context, } ret = rename(&newname[5], FILENAME(id)); +#ifdef RENAME_DOES_NOT_UNLINK + if (ret && (errno == EEXIST || errno == EACCES)) { + ret = unlink(FILENAME(id)); + if (ret == 0) { + ret = rename(&newname[5], FILENAME(id)); + } + } +#endif if (ret) ret = errno; free(newname);