httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wr...@locus.apache.org
Subject cvs commit: apache-2.0/src CHANGES
Date Tue, 21 Nov 2000 18:40:42 GMT
wrowe       00/11/21 10:40:42

  Modified:    src/support rotatelogs.c
               src/main http_log.c
               src      CHANGES
  Log:
    *) Accomodate an out-of-space condition in the piped logs and the
       rotatelogs.c code, and no longer churn log processes for this
       condition.  [Victor J. Orlikowski]
  
  Revision  Changes    Path
  1.11      +49 -11    apache-2.0/src/support/rotatelogs.c
  
  Index: rotatelogs.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/support/rotatelogs.c,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- rotatelogs.c	2000/11/17 19:26:15	1.10
  +++ rotatelogs.c	2000/11/21 18:40:35	1.11
  @@ -72,6 +72,7 @@
   #include <fcntl.h>
   
   #define BUFSIZE         65536
  +#define ERRMSGSZ        82
   
   #ifndef MAX_PATH
   #define MAX_PATH        1024
  @@ -79,11 +80,9 @@
   
   int main (int argc, char *argv[])
   {
  -    char buf[BUFSIZE], buf2[MAX_PATH];
  -    time_t tLogEnd = 0;
  -    time_t tRotation;
  -    int nLogFD = -1;
  -    int nRead;
  +    char buf[BUFSIZE], buf2[MAX_PATH], errbuf[ERRMSGSZ];
  +    time_t tLogEnd = 0, tRotation;
  +    int nLogFD = -1, nLogFDprev = -1, nMessCount = 0, nRead, nWrite;
       char *szLogRoot;
   
       if (argc != 3) {
  @@ -123,7 +122,7 @@
               if (errno != EINTR)
                   exit(4);
           if (nLogFD >= 0 && (time(NULL) >= tLogEnd || nRead < 0)) {
  -            close(nLogFD);
  +            nLogFDprev = nLogFD;
               nLogFD = -1;
           }
           if (nLogFD < 0) {
  @@ -132,13 +131,52 @@
               tLogEnd = tLogStart + tRotation;
               nLogFD = open(buf2, O_WRONLY | O_CREAT | O_APPEND, 0666);
               if (nLogFD < 0) {
  -                perror(buf2);
  -                exit(2);
  +                /* Uh-oh. Failed to open the new log file. Try to clear
  +                 * the previous log file, note the lost log entries,
  +                 * and keep on truckin'. */
  +                if (nLogFDprev == -1) {
  +                    perror(buf2);
  +                    exit(2);
  +                }
  +                else {
  +                    nLogFD = nLogFDprev;
  +                    sprintf(errbuf,
  +                            "Resetting log file due to error opening "
  +                            "new log file. %10d messages lost.\n",
  +                            nMessCount);
  +                    nWrite = strlen(errbuf);
  +#ifdef WIN32
  +                    chsize(nLogFD, 0);
  +#else
  +                    ftruncate(nLogFD, 0);
  +#endif
  +                    write(nLogFD, errbuf, nWrite);
  +                }
  +            }
  +            else {
  +                close(nLogFDprev);
               }
  +            nMessCount = 0;
  +        }
  +        do {
  +            nWrite = write(nLogFD, buf, nRead);
  +        } while (nWrite < 0 && errno == EINTR);
  +        if (nWrite != nRead) {
  +            nMessCount++;
  +            sprintf(errbuf,
  +                    "Error writing to log file. "
  +                    "%10d messages lost.\n",
  +                    nMessCount);
  +            nWrite = strlen(errbuf);
  +#ifdef WIN32
  +            chsize(nLogFD, 0);
  +#else
  +            ftruncate(nLogFD, 0);
  +#endif
  +            write (nLogFD, errbuf, nWrite);
           }
  -        if (write(nLogFD, buf, nRead) != nRead) {
  -            perror(buf2);
  -            exit(5);
  +        else {
  +            nMessCount++;
           }
       }
       /* Of course we never, but prevent compiler warnings */
  
  
  
  1.74      +2 -3      apache-2.0/src/main/http_log.c
  
  Index: http_log.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/main/http_log.c,v
  retrieving revision 1.73
  retrieving revision 1.74
  diff -u -r1.73 -r1.74
  --- http_log.c	2000/11/14 02:42:51	1.73
  +++ http_log.c	2000/11/21 18:40:38	1.74
  @@ -639,9 +639,8 @@
   	break;
       
       case APR_OC_REASON_UNWRITABLE:
  -	if (pl->pid != NULL) {
  -	    apr_kill(pl->pid, SIGTERM);
  -	}
  +        /* We should not kill off the pipe here, since it may only be full.
  +         * If it really is locked, we should kill it off manually. */
   	break;
       
       case APR_OC_REASON_RESTART:
  
  
  
  1.345     +7 -0      apache-2.0/src/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/CHANGES,v
  retrieving revision 1.344
  retrieving revision 1.345
  diff -u -r1.344 -r1.345
  --- CHANGES	2000/11/20 22:39:15	1.344
  +++ CHANGES	2000/11/21 18:40:40	1.345
  @@ -1,7 +1,14 @@
   Changes with Apache 2.0a9
  +
  +  *) Accomodate an out-of-space condition in the piped logs and the
  +     rotatelogs.c code, and no longer churn log processes for this
  +     condition.  [Victor J. Orlikowski]
  +
     *) Add support for partial writes with apr_sendfile() to core_output_filter.
        [Greg Ames] 
  +
   Changes with Apache 2.0a8
  +
     *) Add a directive to mod_mime so that filters can be associated with
        a given mime-type.
        [Ryan Bloom]
  
  
  

Mime
View raw message