]> granicus.if.org Git - apache/commitdiff
Axe some warnings in rotatelogs which came when the program was
authorJeff Trawick <trawick@apache.org>
Wed, 20 Nov 2002 00:09:56 +0000 (00:09 +0000)
committerJeff Trawick <trawick@apache.org>
Wed, 20 Nov 2002 00:09:56 +0000 (00:09 +0000)
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

support/rotatelogs.c

index 02fec519e748c85fea32e2652320e2b7b45c50cf..50194a725afaa6ad39cf4a9039b255a02759c808 100644 (file)
@@ -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,