diff options
| author | Joshua Judson Rosen <jrosen@harvestai.com> | 2014-07-02 19:41:41 +0200 |
|---|---|---|
| committer | Denys Vlasenko <vda.linux@googlemail.com> | 2014-07-02 19:41:41 +0200 |
| commit | e46047aa87c9ec0b8e27d1d4ecfcb3e9798ddb8d (patch) | |
| tree | 20f4641e15be847806a481b495b227846130d311 | |
| parent | a28c1b21e1a3770b83fe9b15f26ec50f2e14e7f6 (diff) | |
| download | busybox-w32-e46047aa87c9ec0b8e27d1d4ecfcb3e9798ddb8d.tar.gz busybox-w32-e46047aa87c9ec0b8e27d1d4ecfcb3e9798ddb8d.tar.bz2 busybox-w32-e46047aa87c9ec0b8e27d1d4ecfcb3e9798ddb8d.zip | |
syslogd: syslogd: don't *decrement* log_file->size on write failures
Even if we fail to write to a log-file, and it's not growing,
it's not *shrinking* either....
Signed-off-by: Joshua Judson Rosen <jrosen@harvestai.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| -rw-r--r-- | sysklogd/syslogd.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/sysklogd/syslogd.c b/sysklogd/syslogd.c index d80447bd7..04221fc33 100644 --- a/sysklogd/syslogd.c +++ b/sysklogd/syslogd.c | |||
| @@ -569,7 +569,7 @@ static void log_to_kmsg(int pri, const char *msg) | |||
| 569 | */ | 569 | */ |
| 570 | pri &= G.primask; | 570 | pri &= G.primask; |
| 571 | 571 | ||
| 572 | write(G.kmsgfd, G.printbuf, sprintf(G.printbuf, "<%d>%s\n", pri, msg)); | 572 | full_write(G.kmsgfd, G.printbuf, sprintf(G.printbuf, "<%d>%s\n", pri, msg)); |
| 573 | } | 573 | } |
| 574 | #else | 574 | #else |
| 575 | static void kmsg_init(void) {} | 575 | static void kmsg_init(void) {} |
| @@ -678,9 +678,14 @@ static void log_locally(time_t now, char *msg, logFile_t *log_file) | |||
| 678 | close(log_file->fd); | 678 | close(log_file->fd); |
| 679 | goto reopen; | 679 | goto reopen; |
| 680 | } | 680 | } |
| 681 | log_file->size += | 681 | /* TODO: what to do on write errors ("disk full")? */ |
| 682 | len = full_write(log_file->fd, msg, len); | ||
| 683 | if (len > 0) | ||
| 684 | log_file->size += len; | ||
| 685 | #else | ||
| 686 | full_write(log_file->fd, msg, len); | ||
| 682 | #endif | 687 | #endif |
| 683 | full_write(log_file->fd, msg, len); | 688 | |
| 684 | #ifdef SYSLOGD_WRLOCK | 689 | #ifdef SYSLOGD_WRLOCK |
| 685 | fl.l_type = F_UNLCK; | 690 | fl.l_type = F_UNLCK; |
| 686 | fcntl(log_file->fd, F_SETLKW, &fl); | 691 | fcntl(log_file->fd, F_SETLKW, &fl); |
