From dc9903512d520f9c69a62089ce03912e9cc45976 Mon Sep 17 00:00:00 2001 From: Michael Smith Date: Wed, 5 May 2004 05:05:05 +0000 Subject: [PATCH] Use remove() then rename() only on win32 - where it's required. Don't use it on unix systems, which don't need it, and where doing _only_ rename() preserves atomicity. svn path=/icecast/trunk/icecast/; revision=6625 --- src/auth.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/auth.c b/src/auth.c index 67334e49..8d9116b0 100644 --- a/src/auth.c +++ b/src/auth.c @@ -366,6 +366,7 @@ int auth_htpasswd_deleteuser(auth_t *auth, char *username) fclose(passwdfile); /* Now move the contents of the tmp file to the original */ +#ifdef _WIN32 /* Windows won't let us rename a file if the destination file exists...so, lets remove the original first */ if (remove(state->filename) != 0) { @@ -373,11 +374,14 @@ int auth_htpasswd_deleteuser(auth_t *auth, char *username) tmpfile, state->filename, strerror(errno)); } else { +#endif if (rename(tmpfile, state->filename) != 0) { ERROR3("Problem moving temp authentication file to original \"%s\" - \"%s\": %s", tmpfile, state->filename, strerror(errno)); } +#ifdef _WIN32 } +#endif free(tmpfile);