diff options
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); + } + } } + |