summaryrefslogtreecommitdiffstats
path: root/support/rotatelogs.c
diff options
context:
space:
mode:
authorJeff Trawick <trawick@apache.org>2002-11-20 01:09:56 +0100
committerJeff Trawick <trawick@apache.org>2002-11-20 01:09:56 +0100
commit12f572f037f4dd0c2ca7b40eb3b685da3ce9b39f (patch)
tree49bdf59a2bd56926b055878d80900c8fdbdf2a12 /support/rotatelogs.c
parentbucket length parameter is apr_size_t, which isn't always signed, (diff)
downloadapache2-12f572f037f4dd0c2ca7b40eb3b685da3ce9b39f.tar.xz
apache2-12f572f037f4dd0c2ca7b40eb3b685da3ce9b39f.zip
Axe some warnings in rotatelogs which came when the program was
converted to use APR. The behaviors of apr_file_read() and apr_file_write() weren't taken completely into account. But note: In a couple of places the check "nRead < 0" was removed. While that is meaningless with APR and hasn't done anything useful in a long time, in Apache 1.3 days it was essentially a check for read-failed-with-EINTR. Apparently a rotation would occur if the read was interrupted by a signal. That function has been lost with the APR-ization. PR: 12617 git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@97570 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'support/rotatelogs.c')
-rw-r--r--support/rotatelogs.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/support/rotatelogs.c b/support/rotatelogs.c
index 02fec519e7..50194a725a 100644
--- a/support/rotatelogs.c
+++ b/support/rotatelogs.c
@@ -168,11 +168,9 @@ int main (int argc, const char * const argv[])
nRead = sizeof(buf);
if (apr_file_read(f_stdin, buf, &nRead) != APR_SUCCESS)
exit(3);
- if (nRead == 0)
- exit(3);
if (tRotation) {
now = (int)(apr_time_now() / APR_USEC_PER_SEC) + utc_offset;
- if (nLogFD != NULL && (now >= tLogEnd || nRead < 0)) {
+ if (nLogFD != NULL && now >= tLogEnd) {
nLogFDprev = nLogFD;
nLogFD = NULL;
}
@@ -186,7 +184,7 @@ int main (int argc, const char * const argv[])
current_size = finfo.size;
}
- if (current_size > sRotation || nRead < 0) {
+ if (current_size > sRotation) {
nLogFDprev = nLogFD;
nLogFD = NULL;
}
@@ -245,10 +243,8 @@ int main (int argc, const char * const argv[])
}
nMessCount = 0;
}
- do {
- nWrite = nRead;
- apr_file_write(nLogFD, buf, &nWrite);
- } while (nWrite < 0 && errno == EINTR);
+ nWrite = nRead;
+ apr_file_write(nLogFD, buf, &nWrite);
if (nWrite != nRead) {
nMessCount++;
sprintf(errbuf,