mirror of
https://github.com/troglobit/finit.git
synced 2026-11-01 13:10:32 +00:00
logit: Sync each log entry to file
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
1 parent
0e51a1eed8
commit
44591c6e51
1 file changed
+2
@@ -125,11 +125,13 @@ reopen:
|
|||||||
|
|
||||||
if (buf[0]) {
|
if (buf[0]) {
|
||||||
fprintf(fp, "%s\n", buf);
|
fprintf(fp, "%s\n", buf);
|
||||||
|
fsync(fileno(fp));
|
||||||
if (checksz(fp, sz))
|
if (checksz(fp, sz))
|
||||||
return logrotate(logfile, num, sz);
|
return logrotate(logfile, num, sz);
|
||||||
} else {
|
} else {
|
||||||
while ((fgets(buf, len, stdin))) {
|
while ((fgets(buf, len, stdin))) {
|
||||||
fputs(buf, fp);
|
fputs(buf, fp);
|
||||||
|
fsync(fileno(fp));
|
||||||
|
|
||||||
if (checksz(fp, sz)) {
|
if (checksz(fp, sz)) {
|
||||||
logrotate(logfile, num, sz);
|
logrotate(logfile, num, sz);
|
||||||
|
|||||||
Reference in new issue
Block a user