-diff -ruN cvs-1.11.2.org/src/login.c cvs-1.11.2/src/login.c
---- cvs-1.11.2.org/src/login.c Sat Jun 1 23:47:43 2002
-+++ cvs-1.11.2/src/login.c Sat Jun 1 23:49:12 2002
-@@ -30,7 +30,7 @@
- #endif
+--- cvs-1.11.4/src/filesubr.c.orig Tue Sep 24 22:47:09 2002
++++ cvs-1.11.4/src/filesubr.c Fri Jan 17 20:59:20 2003
+@@ -18,6 +18,7 @@
+ file system semantics. */
- #ifndef CVS_PASSWORD_FILE
--#define CVS_PASSWORD_FILE ".cvspass"
-+#define CVS_PASSWORD_FILE "cvspass"
- #endif
+ #include <assert.h>
++#include <sys/stat.h>
+ #include "cvs.h"
- /* If non-NULL, get_cvs_password() will just return this. */
-@@ -65,8 +65,13 @@
- return (char *) NULL;
- }
-
-+ if (getenv("CONFIG_DIR")) {
-+ passfile = (char *) xmalloc (strlen (homedir) + strlen (getenv("CONFIG_DIR")) + strlen (CVS_PASSWORD_FILE) + 4);
-+ sprintf (passfile, "%s/%s/%s", homedir, getenv("CONFIG_DIR"), CVS_PASSWORD_FILE);
-+ }
-+ else {
- passfile =
-- (char *) xmalloc (strlen (homedir) + strlen (CVS_PASSWORD_FILE) + 3);
-+ (char *) xmalloc (strlen (homedir) + strlen (CVS_PASSWORD_FILE) + 4);
- strcpy (passfile, homedir);
- #ifndef NO_SLASH_AFTER_HOME
- /* NO_SLASH_AFTER_HOME is defined for VMS, where foo:[bar]/.cvspass is not
-@@ -75,7 +80,9 @@
- kind of thing.... */
- strcat (passfile, "/");
- #endif
-+ strcat (passfile, ".");
- strcat (passfile, CVS_PASSWORD_FILE);
+ static int deep_remove_dir PROTO((const char *path));
+@@ -969,8 +970,24 @@
+ const char *dir;
+ const char *file;
+ {
+- char *path = xmalloc (strlen (dir) + 1 + strlen(file) + 1);
+- sprintf (path, "%s/%s", dir, file);
++ char *path,*cfgdir;
++ struct stat st;
++ int isdot = (*file == '.');
++
++ if ( (path = getenv("CONFIG_DIR")) && path[0] ) {
++ cfgdir = xmalloc(strlen(dir) + 1 + strlen(path) + 1);
++ sprintf(cfgdir, "%s/%s", dir, path);
++ } else
++ cfgdir = NULL;
++ if ( cfgdir && (stat(cfgdir, &st) != -1) && S_ISDIR(st.st_mode) ) {
++ path = xmalloc(strlen(cfgdir) + 1 + strlen(file)-isdot + 1);
++ sprintf (path, "%s/%s", cfgdir, file+isdot);
++ } else {
++ path = xmalloc (strlen (dir) + 1 + strlen(file) + 1);
++ sprintf (path, "%s/%s", dir, file);
+ }
++ if (cfgdir)
++ free(cfgdir);
+ return path;
+ }
- /* Safety first and last, Scouts. */
- if (isfile (passfile))