You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Dean Gaudet <dg...@arctic.org> on 1997/01/03 02:50:46 UTC

Re: pfopen errno patch (take 2)

Um, ahem.  Take 2.  The last one was a somewhat hasty patch made in the
middle of an upgrade of hotwired's code to 1.2 from 1.1.1+lots_of_crap.

Dean

*** apache_1.2b4/src/alloc.c	Sat Dec 14 12:28:45 1996
--- apache_new/src/alloc.c	Thu Jan  2 17:49:31 1997
***************
*** 62,67 ****
--- 62,68 ----
  #include "alloc.h"
  
  #include <stdarg.h>
+ #include <errno.h>
  
  /*****************************************************************
   *
***************
*** 777,782 ****
--- 778,784 ----
  {
    FILE *fd = NULL;
    int baseFlag, desc;
+   int save_errno;
  
    block_alarms();
  
***************
*** 785,799 ****
--- 787,805 ----
      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);
+     save_errno = errno;
      if (desc >= 0) {
        fd = fdopen(desc, mode);
+       save_errno = errno;
      }
    } else {
      fd = fopen(name, mode);
+     save_errno = errno;
    }
  
    if (fd != NULL) note_cleanups_for_file (a, fd);
    unblock_alarms();
+   errno = save_errno;
    return fd;
  }