diff options
author | Nick Mathewson <nickm@torproject.org> | 2014-07-16 13:58:55 +0200 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2014-07-16 13:58:55 +0200 |
commit | 867f5e6a7602fe5cf54686aa04995eaabaea4c80 (patch) | |
tree | 3954fab482ffc83324ae53a7d252c5479ddc09b9 /src/common/log.c | |
parent | 15e170e01b3f67325f952d0becda0438fa879907 (diff) | |
download | tor-867f5e6a7602fe5cf54686aa04995eaabaea4c80.tar.gz tor-867f5e6a7602fe5cf54686aa04995eaabaea4c80.zip |
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.)
Diffstat (limited to 'src/common/log.c')
-rw-r--r-- | src/common/log.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/common/log.c b/src/common/log.c index 7c8a48746a..4ddd54fab0 100644 --- a/src/common/log.c +++ b/src/common/log.c @@ -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); + } + } } + |