[xiph-cvs] r6616 - icecast/trunk/icecast/src

oddsock at xiph.org oddsock at xiph.org
Tue May 4 21:30:56 PDT 2004



Author: oddsock
Date: 2004-05-03 10:59:40 -0400 (Mon, 03 May 2004)
New Revision: 6616

Modified:
   icecast/trunk/icecast/src/auth.c
Log:
some special handling with rename() needed for win32

<p>Modified: icecast/trunk/icecast/src/auth.c
===================================================================
--- icecast/trunk/icecast/src/auth.c	2004-05-03 14:56:57 UTC (rev 6615)
+++ icecast/trunk/icecast/src/auth.c	2004-05-03 14:59:40 UTC (rev 6616)
@@ -366,10 +366,18 @@
     fclose(passwdfile);
 
     /* 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", 
                 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);
 

--- >8 ----
List archives:  http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'cvs-request at xiph.org'
containing only the word 'unsubscribe' in the body.  No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.



More information about the commits mailing list