mirror of
https://gitlab.xiph.org/xiph/icecast-server.git
synced 2024-09-22 04:15:54 -04:00
some special handling with rename() needed for win32
svn path=/icecast/trunk/icecast/; revision=6616
This commit is contained in:
parent
e597b63c6a
commit
dfdff77871
10
src/auth.c
10
src/auth.c
@ -366,10 +366,18 @@ int auth_htpasswd_deleteuser(auth_t *auth, char *username)
|
|||||||
fclose(passwdfile);
|
fclose(passwdfile);
|
||||||
|
|
||||||
/* Now move the contents of the tmp file to the original */
|
/* Now move the contents of the tmp file to the original */
|
||||||
if (rename(tmpfile, state->filename) != 0) {
|
/* Windows won't let us rename a file if the destination file
|
||||||
|
exists...so, lets remove the original first */
|
||||||
|
if (remove(state->filename) != 0) {
|
||||||
ERROR3("Problem moving temp authentication file to original \"%s\" - \"%s\": %s",
|
ERROR3("Problem moving temp authentication file to original \"%s\" - \"%s\": %s",
|
||||||
tmpfile, state->filename, strerror(errno));
|
tmpfile, state->filename, strerror(errno));
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
if (rename(tmpfile, state->filename) != 0) {
|
||||||
|
ERROR3("Problem moving temp authentication file to original \"%s\" - \"%s\": %s",
|
||||||
|
tmpfile, state->filename, strerror(errno));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
free(tmpfile);
|
free(tmpfile);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user