This is not clean and has not been tested, but is a possible implementation of rewriteEntry for WIN32:
@@ -1324,12 +1329,38 @@ int buf_is_chunk, bufsize; int offset; +#ifdef WIN32 + /* malloc/free might be better, but there are a lot of error return cases to cover */ + char wintmp[1024]; + + strcpy(wintmp, object->disk_entry->filename); + strcat(wintmp, ".1"); + + close(object->disk_entry->fd); + object->disk_entry->fd = -1; + rename(object->disk_entry->filename, wintmp); + + /* This is not clean, but makes destroyDiskEntry function as expected */ + entry->object->flags &= ~OBJECT_DISK_ENTRY_COMPLETE; + object->disk_entry->fd = open(object->disk_entry->filename, O_RDWR | O_CREAT | O_EXCL | O_BINARY, + diskCacheFilePermissions); + if(object->disk_entry->fd < 0) { + do_log_error(L_ERROR, errno, "Couldn't create file %s", wintmp); + return -1; + } + + fd = open(wintmp, O_RDONLY | O_BINARY); + if(fd < 0) { + do_log_error(L_ERROR, errno, "Couldn't open file %s", wintmp); + return -1; + } +#else fd = dup(object->disk_entry->fd); if(fd < 0) { do_log_error(L_ERROR, errno, "Couldn't duplicate file descriptor"); return -1; } - +#endif rc = destroyDiskEntry(object, 1); if(rc < 0) { close(fd); @@ -1392,6 +1423,9 @@ if(object->length >= 0 && entry->size == object->length) object->flags |= OBJECT_DISK_ENTRY_COMPLETE; close(fd); +#ifdef WIN32 + unlink(wintmp); +#endif if(buf_is_chunk) dispose_chunk(buf); else ------------------------------------------------------------------------------ Site24x7 APM Insight: Get Deep Visibility into Application Performance APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month Monitor end-to-end web transactions and take corrective actions now Troubleshoot faster and improve end-user experience. Signup Now! http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140 _______________________________________________ Polipo-users mailing list Polipo-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/polipo-users