Add a tor_ftruncate to replace ftruncate.

(Windows doesn't have ftruncate, and some ftruncates do not move the
file pointer to the start of the file.)
This commit is contained in:
Nick Mathewson
2014-07-16 13:58:55 +02:00
parent 15e170e01b
commit 867f5e6a76
4 changed files with 73 additions and 2 deletions
+6 -2
View File
@@ -1305,6 +1305,10 @@ switch_logs_debug(void)
void
truncate_logs(void)
{
for (logfile_t *lf = logfiles; lf; lf = lf->next)
ftruncate(lf->fd, 0);
for (logfile_t *lf = logfiles; lf; lf = lf->next) {
if (lf->fd >= 0) {
tor_ftruncate(lf->fd);
}
}
}