diff -urNp -x '*.orig' cvs-1.12.13.org/src/login.c cvs-1.12.13/src/login.c --- cvs-1.12.13.org/src/login.c 2005-05-13 23:47:28.000000000 +0200 +++ cvs-1.12.13/src/login.c 2023-02-02 09:01:00.365363622 +0100 @@ -309,9 +309,25 @@ internal error: can only call password_e fp = CVS_FOPEN (passfile, "r"); if (fp == NULL) { + /* The password file doesn't exist yet - probably because it's + * the first time someone uses cvs login. Create it. + */ + fp = CVS_FOPEN (passfile, "w"); + if (fp == NULL) + { + /* Creating the password file didn't work. Bail out. */ + error(0, errno, "warning: failed to open %s for writing", passfile); + goto process; + } + fclose (fp); + fp = CVS_FOPEN (passfile, "r"); + if (fp == NULL) + { + /* Opening the password file didn't work. Bail out. */ error (0, errno, "warning: failed to open %s for reading", passfile); goto process; } + } /* Check each line to see if we have this entry already. */ line = 0L;