mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-12-06 19:41:15 +01:00
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:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user