You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by tr...@apache.org on 2002/11/20 01:09:56 UTC

cvs commit: httpd-2.0/support rotatelogs.c

trawick     2002/11/19 16:09:56

  Modified:    support  rotatelogs.c
  Log:
  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
  
  Revision  Changes    Path
  1.27      +4 -8      httpd-2.0/support/rotatelogs.c
  
  Index: rotatelogs.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/support/rotatelogs.c,v
  retrieving revision 1.26
  retrieving revision 1.27
  diff -u -r1.26 -r1.27
  --- rotatelogs.c	14 Jun 2002 17:16:03 -0000	1.26
  +++ rotatelogs.c	20 Nov 2002 00:09:56 -0000	1.27
  @@ -168,11 +168,9 @@
           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 @@
                   current_size = finfo.size;
               }
   
  -            if (current_size > sRotation || nRead < 0) {
  +            if (current_size > sRotation) {
                   nLogFDprev = nLogFD;
                   nLogFD = NULL;
               }
  @@ -245,10 +243,8 @@
               }
               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,