Skip to content

Commit d1a86fe

Browse files
committed
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
1 parent 4873370 commit d1a86fe

1 file changed

Lines changed: 4 additions & 8 deletions

File tree

support/rotatelogs.c

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -168,11 +168,9 @@ int main (int argc, const char * const argv[])
168168
nRead = sizeof(buf);
169169
if (apr_file_read(f_stdin, buf, &nRead) != APR_SUCCESS)
170170
exit(3);
171-
if (nRead == 0)
172-
exit(3);
173171
if (tRotation) {
174172
now = (int)(apr_time_now() / APR_USEC_PER_SEC) + utc_offset;
175-
if (nLogFD != NULL && (now >= tLogEnd || nRead < 0)) {
173+
if (nLogFD != NULL && now >= tLogEnd) {
176174
nLogFDprev = nLogFD;
177175
nLogFD = NULL;
178176
}
@@ -186,7 +184,7 @@ int main (int argc, const char * const argv[])
186184
current_size = finfo.size;
187185
}
188186

189-
if (current_size > sRotation || nRead < 0) {
187+
if (current_size > sRotation) {
190188
nLogFDprev = nLogFD;
191189
nLogFD = NULL;
192190
}
@@ -245,10 +243,8 @@ int main (int argc, const char * const argv[])
245243
}
246244
nMessCount = 0;
247245
}
248-
do {
249-
nWrite = nRead;
250-
apr_file_write(nLogFD, buf, &nWrite);
251-
} while (nWrite < 0 && errno == EINTR);
246+
nWrite = nRead;
247+
apr_file_write(nLogFD, buf, &nWrite);
252248
if (nWrite != nRead) {
253249
nMessCount++;
254250
sprintf(errbuf,

0 commit comments

Comments
 (0)