mirror of
https://github.com/topjohnwu/ndk-busybox.git
synced 2024-12-13 06:25:46 +00:00
syslogd: avoid spurious ftrunctate() calls for "-b 0"
Forgetting to re-set log_file->size after truncating to zero discards log-data for the next 1 second following an oversize-induced purge, when we shouldn't necessarily throw that data away. Signed-off-by: Joshua Judson Rosen <jrosen@harvestai.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
parent
fd0640e5a1
commit
1b90e031c3
@ -663,7 +663,13 @@ static void log_locally(time_t now, char *msg, logFile_t *log_file)
|
|||||||
close(log_file->fd);
|
close(log_file->fd);
|
||||||
goto reopen;
|
goto reopen;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* We don't get here unless G.logFileRotate == 0;
|
||||||
|
* in which case don't bother unlinking and reopening,
|
||||||
|
* just truncate and reset size to match:
|
||||||
|
*/
|
||||||
ftruncate(log_file->fd, 0);
|
ftruncate(log_file->fd, 0);
|
||||||
|
log_file->size = 0;
|
||||||
}
|
}
|
||||||
log_file->size +=
|
log_file->size +=
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user