httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From c...@locus.apache.org
Subject cvs commit: apache-2.0/src/support htpasswd.c
Date Wed, 03 May 2000 17:55:39 GMT
coar        00/05/03 10:55:39

  Modified:    src      CHANGES
               src/support htpasswd.c
  Log:
  	Use our own buffer for tmpnam() if the platform seems to know
  	about it.  Avoids threading and reentrancy problems.
  
  Revision  Changes    Path
  1.101     +3 -1      apache-2.0/src/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/CHANGES,v
  retrieving revision 1.100
  retrieving revision 1.101
  diff -u -u -r1.100 -r1.101
  --- CHANGES	2000/05/03 17:24:40	1.100
  +++ CHANGES	2000/05/03 17:55:38	1.101
  @@ -5,7 +5,9 @@
        [Tony Finch]
   
     *) Add some more error reporting to htpasswd in the case of problems
  -     generating or accessing the temporary file.  [Ken Coar]
  +     generating or accessing the temporary file.  Also, pass in a
  +     buffer if the implementation knows how to use it (i.e., if L_tmpnam
  +     is defined).  [Ken Coar]
   
     *) Configure creates config.nice now containing your configure
        options. Syntax: ./config.nice [--more-options]
  
  
  
  1.11      +16 -1     apache-2.0/src/support/htpasswd.c
  
  Index: htpasswd.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/support/htpasswd.c,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -u -r1.10 -r1.11
  --- htpasswd.c	2000/05/03 10:32:45	1.10
  +++ htpasswd.c	2000/05/03 17:55:38	1.11
  @@ -117,6 +117,14 @@
    * access it.
    */
   static char *tempfilename;
  +/*
  + * If our platform knows about the tmpnam() external buffer size, create
  + * a buffer to pass in.  This is needed in a threaded environment, or
  + * one that thinks it is (like HP-UX).
  + */
  +#ifdef L_tmpnam
  +static char tname_buf[L_tmpnam];
  +#endif
   
   /*
    * Get a line of input from the user, not including any terminating
  @@ -517,11 +525,18 @@
        * We can access the files the right way, and we have a record
        * to add or update.  Let's do it..
        */
  +    errno = 0;
  +#ifdef L_tmpnam
  +    tempfilename = tmpnam(tname_buf);
  +#else   /* def L_tmpnam */
       tempfilename = tmpnam(NULL);
  +#endif  /* def L_tmpnam */
       if ((tempfilename == NULL) || (strlen(tempfilename) == 0)) {
   	fprintf(stderr, "%s: unable to generate temporary filename\n",
   		argv[0]);
  -	errno = ENOENT;
  +	if (errno == 0) {
  +	    errno = ENOENT;
  +	}
   	perror("tmpnam");
   	exit(ERR_FILEPERM);
       }
  
  
  

Mime
View raw message