Ticket #108: flint_table.cc.2.patch
File flint_table.cc.2.patch, 1.2 KB (added by , 18 years ago) |
---|
-
flint_table.cc
23 23 #include <config.h> 24 24 25 25 #include "safeerrno.h" 26 26 #include "safewindows.h" 27 27 // Define to use "dangerous" mode - in this mode we write modified btree 28 28 // blocks back in place. This is somewhat faster (especially once we're 29 29 // I/O bound) but the database can't be safely searched during indexing … … 130 130 131 131 static void sys_unlink(const string &filename) 132 132 { 133 #ifdef _MSC_VER 134 /* We must use DeleteFile as this can delete files that are open */ 135 if(DeleteFile(filename.c_str()) == 0) { 136 DWORD dwErr = GetLastError(); 137 switch(dwErr){ 138 case ERROR_FILE_NOT_FOUND: _set_errno(ENOENT); break; 139 case ERROR_SHARING_VIOLATION: 140 /* The file should have been opened with FILE_SHARE_DELETE if it is allowed 141 to be deleted, so if we get a sharing violation something's gone wrong */ 142 case ERROR_ACCESS_DENIED: _set_errno(EACCES); break; 143 } 144 #else 133 145 if (unlink(filename) == -1) { 146 #endif 134 147 string message = "Failed to unlink "; 135 148 message += filename; 136 149 message += ": ";