[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[or-cvs] r9038: Apparently Windows takes a dim view of unlinking a file whil (in tor/trunk: . src/or)



Author: nickm
Date: 2006-12-07 10:06:38 -0500 (Thu, 07 Dec 2006)
New Revision: 9038

Modified:
   tor/trunk/
   tor/trunk/src/or/test.c
Log:
 r11451@Kushana:  nickm | 2006-12-07 10:06:30 -0500
 Apparently Windows takes a dim view of unlinking a file while it is mapped.  Silly windows, did nobody ever tell you about inodes?



Property changes on: tor/trunk
___________________________________________________________________
 svk:merge ticket from /tor/trunk [r11451] on c95137ef-5f19-0410-b913-86e773d04f59

Modified: tor/trunk/src/or/test.c
===================================================================
--- tor/trunk/src/or/test.c	2006-12-07 14:52:47 UTC (rev 9037)
+++ tor/trunk/src/or/test.c	2006-12-07 15:06:38 UTC (rev 9038)
@@ -1295,10 +1295,14 @@
   test_assert(mapping);
   test_eq(mapping->size, strlen("Short file."));
   test_streq(mapping->data, "Short file.");
+#ifdef MS_WINDOWS
+  tor_munmap_file(mapping);
+  test_assert(unlink(fname1) == 0);
+#else
   /* make sure we can unlink. */
   test_assert(unlink(fname1) == 0);
   test_streq(mapping->data, "Short file.");
-  tor_munmap_file(mapping);
+#endif
 
   /* Make sure that we fail to map a no-longer-existent file. */
   mapping = tor_mmap_file(fname1);
@@ -1316,6 +1320,7 @@
   test_assert(mapping);
   test_eq(mapping->size, 16384);
   test_memeq(mapping->data, buf, 16384);
+  tor_munmap_file(mapping);
 
   /* fname1 got unlinked above */
   unlink(fname2);