If we write the annotation but not the microdescriptor, rewind.

This fixes bug 9047 (and some parts of 9031, 8922, 8883 that weren't
fixed in 8822).  Bugfix on 0.2.2.6-alpha.
This commit is contained in:
Nick Mathewson
2013-06-13 12:29:01 -04:00
parent 25dddf7a8f
commit caa0d15c49
4 changed files with 32 additions and 6 deletions
+12
View File
@@ -900,6 +900,18 @@ tor_fd_seekend(int fd)
#endif
}
/** Move <b>fd</b> to position <b>pos</b> in the file. Return -1 on error, 0
* on success. */
int
tor_fd_setpos(int fd, off_t pos)
{
#ifdef _WIN32
return _lseek(fd, pos, SEEK_SET) < 0 ? -1 : 0;
#else
return lseek(fd, pos, SEEK_SET) < 0 ? -1 : 0;
#endif
}
#undef DEBUG_SOCKET_COUNTING
#ifdef DEBUG_SOCKET_COUNTING
/** A bitarray of all fds that should be passed to tor_socket_close(). Only
+1
View File
@@ -411,6 +411,7 @@ tor_lockfile_t *tor_lockfile_lock(const char *filename, int blocking,
void tor_lockfile_unlock(tor_lockfile_t *lockfile);
off_t tor_fd_getpos(int fd);
int tor_fd_setpos(int fd, off_t pos);
int tor_fd_seekend(int fd);
#ifdef _WIN32