httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brian Behlendorf <br...@hyperreal.com>
Subject cvs commit: apache/src alloc.c
Date Tue, 01 Oct 1996 03:24:07 GMT
brian       96/09/30 20:24:06

  Modified:    src       alloc.c
  Log:
  Reviewed by:	Brian Behlendorf
  Submitted by:	Mark Brown, mbrown@openmarket.com
  
  On Tue, 24 Sep 1996, Mark Brown wrote:
  > Here is a patch for the error log overwrite problem I reported
  > earlier.  I have tested the patch on SunOS 4.1.4.
  >
  > The patch should have no ill effect on correct systems.
  
  Revision  Changes    Path
  1.13      +16 -2     apache/src/alloc.c
  
  Index: alloc.c
  ===================================================================
  RCS file: /export/home/cvs/apache/src/alloc.c,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -C3 -r1.12 -r1.13
  *** alloc.c	1996/09/13 00:24:51	1.12
  --- alloc.c	1996/10/01 03:24:04	1.13
  ***************
  *** 50,56 ****
     *
     */
    
  ! /* $Id: alloc.c,v 1.12 1996/09/13 00:24:51 jim Exp $ */
    
    
    /*
  --- 50,56 ----
     *
     */
    
  ! /* $Id: alloc.c,v 1.13 1996/10/01 03:24:04 brian Exp $ */
    
    
    /*
  ***************
  *** 773,781 ****
    
    FILE *pfopen(struct pool *a, char *name, char *mode)
    {
  !   FILE *fd;
    
      block_alarms();
      fd = fopen(name, mode);
      if (fd != NULL) note_cleanups_for_file (a, fd);
      unblock_alarms();
  --- 773,795 ----
    
    FILE *pfopen(struct pool *a, char *name, char *mode)
    {
  !   FILE *fd = NULL;
  !   int baseFlag, desc;
    
      block_alarms();
  + 
  +   if (*mode == 'a') {
  +     /* Work around faulty implementations of fopen */
  +     baseFlag = (*(mode+1) == '+') ? O_RDWR : O_WRONLY;
  +     desc = open(name, baseFlag | O_APPEND | O_CREAT,
  + 		S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH);
  +     if (desc >= 0) {
  +       fd = fdopen(desc, mode);
  +     }
  +   } else {
  +     fd = fopen(name, mode);
  +   }
  + 
      fd = fopen(name, mode);
      if (fd != NULL) note_cleanups_for_file (a, fd);
      unblock_alarms();
  
  
  

Mime
View raw message