You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by ma...@hyperreal.org on 2000/01/31 23:24:34 UTC

cvs commit: apache-1.3/src/main http_log.c

martin      00/01/31 14:24:29

  Modified:    src/main http_log.c
  Log:
  Enforce a sensible umask value, even when a stupid default was in effect.
  (Noticed by Frank Miller, Patch by Martin Kraemer)
  
  Submitted by:	Frank Miller <fr...@system-associates.com>
  Reviewed by:	Martin Kraemer
  
  Revision  Changes    Path
  1.82      +10 -0     apache-1.3/src/main/http_log.c
  
  Index: http_log.c
  ===================================================================
  RCS file: /export/home/cvs/apache-1.3/src/main/http_log.c,v
  retrieving revision 1.81
  retrieving revision 1.82
  diff -u -r1.81 -r1.82
  --- http_log.c	1999/10/21 20:44:38	1.81
  +++ http_log.c	2000/01/31 22:24:07	1.82
  @@ -498,6 +498,9 @@
       struct stat finfo;
       static pid_t saved_pid = -1;
       pid_t mypid;
  +#ifndef WIN32
  +    mode_t u;
  +#endif
   
       if (!fname) 
   	return;
  @@ -519,12 +522,19 @@
   		   );
       }
   
  +#ifndef WIN32
  +    u = umask(022);
  +    (void) umask(u | 022);
  +#endif
       if(!(pid_file = fopen(fname, "w"))) {
   	perror("fopen");
           fprintf(stderr, "%s: could not log pid to file %s\n",
   		ap_server_argv0, fname);
           exit(1);
       }
  +#ifndef WIN32
  +    (void) umask(u);
  +#endif
       fprintf(pid_file, "%ld\n", (long)mypid);
       fclose(pid_file);
       saved_pid = mypid;