diff -ru build-tree.orig/apache_1.3.26/src/support/htpasswd.c build-tree/apache_1.3.26/src/support/htpasswd.c
--- build-tree.orig/apache_1.3.26/src/support/htpasswd.c	2002-03-13 16:05:37.000000000 -0500
+++ build-tree/apache_1.3.26/src/support/htpasswd.c	2002-10-19 14:41:30.000000000 -0400
@@ -125,7 +125,7 @@
  * This needs to be declared statically so the signal handler can
  * access it.
  */
-static char *tempfilename;
+static char tempfilename[MAX_STRING_LEN];
 /*
  * If our platform knows about the tmpnam() external buffer size, create
  * a buffer to pass in.  This is needed in a threaded environment, or
@@ -377,8 +377,8 @@
     int noninteractive = 0;
     int i;
     int args_left = 2;
+    int tfd;
 
-    tempfilename = NULL;
     signal(SIGINT, (void (*)(int)) interrupted);
 
     /*
@@ -565,7 +565,8 @@
      * to add or update.  Let's do it..
      */
     errno = 0;
-    tempfilename = tmpnam(tname_buf);
+    strcpy(tempfilename, "/tmp/htpasswd-XXXXXX");
+    tfd = mkstemp(tempfilename);
     if ((tempfilename == NULL) || (*tempfilename == '\0')) {
 	fprintf(stderr, "%s: unable to generate temporary filename\n",
 		argv[0]);
@@ -575,13 +576,13 @@
 	perror("tmpnam");
 	exit(ERR_FILEPERM);
     }
-    ftemp = fopen(tempfilename, "w+");
-    if (ftemp == NULL) {
+    if (tfd == -1) {
 	fprintf(stderr, "%s: unable to create temporary file '%s'\n", argv[0],
 		tempfilename);
-	perror("fopen");
+	perror("open");
 	exit(ERR_FILEPERM);
     }
+    ftemp = fdopen(tfd, "w+");
     /*
      * If we're not creating a new file, copy records from the existing
      * one to the temporary file until we find the specified user.
