[Patch checked in 1998-10-09 -kingdon] [This patch is a straightforward fix. The only reason I'm not checking it in is that I'm not sure whether it would be better after Halibut. The bug is longstanding and relatively minor]. 1998-07-22 Jim Kingdon * wrapper.c, cvsrc.c, ignore.c: Add comments about ignoring .cvsrc and friends if we can't find a home directory. * expand_path.c (expand_path): If we can't find the home directory, give an error rather than a coredump (or worse). * login.c (construct_cvspass_filename): Don't use errno in error message; get_homedir doesn't set it. Add comment about this message. Index: cvsrc.c =================================================================== RCS file: /home2/cvsroot/ccvs/src/cvsrc.c,v retrieving revision 1.18 diff -c -r1.18 cvsrc.c *** cvsrc.c 1998/01/10 17:46:13 1.18 --- cvsrc.c 1998/07/22 18:19:25 *************** *** 65,70 **** --- 65,75 ---- /* determine filename for ~/.cvsrc */ homedir = get_homedir (); + /* If we can't find a home directory, ignore ~/.cvsrc. This may + make tracking down problems a bit of a pain, but on the other + hand it might be obnoxious to complain when CVS will function + just fine without .cvsrc (and many users won't even know what + .cvsrc is). */ if (!homedir) return; Index: expand_path.c =================================================================== RCS file: /home2/cvsroot/ccvs/src/expand_path.c,v retrieving revision 1.17 diff -c -r1.17 expand_path.c *** expand_path.c 1997/11/12 18:44:29 1.17 --- expand_path.c 1998/07/22 18:21:57 *************** *** 214,219 **** --- 214,222 ---- t = ps->pw_dir; #endif } + if (t == NULL) + error (1, 0, "cannot find home directory"); + doff = d - buf; expand_string (&buf, &buf_size, doff + 1); d = buf + doff; Index: ignore.c =================================================================== RCS file: /home2/cvsroot/ccvs/src/ignore.c,v retrieving revision 1.28 diff -c -r1.28 ignore.c *** ignore.c 1997/09/07 23:04:15 1.28 --- ignore.c 1998/07/22 18:30:24 *************** *** 82,87 **** --- 82,92 ---- /* Then add entries found in home dir, (if user has one) and file exists */ home_dir = get_homedir (); + /* If we can't find a home directory, ignore ~/.cvsignore. This may + make tracking down problems a bit of a pain, but on the other + hand it might be obnoxious to complain when CVS will function + just fine without .cvsignore (and many users won't even know what + .cvsignore is). */ if (home_dir) { char *file = xmalloc (strlen (home_dir) + sizeof (CVSDOTIGNORE) + 10); Index: login.c =================================================================== RCS file: /home2/cvsroot/ccvs/src/login.c,v retrieving revision 1.52 diff -c -r1.52 login.c *** login.c 1998/01/10 17:46:17 1.52 --- login.c 1998/07/22 18:28:28 *************** *** 48,54 **** homedir = get_homedir (); if (! homedir) { ! error (1, errno, "could not find out home directory"); return (char *) NULL; } --- 48,61 ---- homedir = get_homedir (); if (! homedir) { ! /* FIXME? This message confuses a lot of users, at least ! on Win95 (which doesn't set HOMEDRIVE and HOMEPATH like ! NT does). I suppose the answer for Win95 is to store the ! passwords in the registry or something (??). And .cvsrc ! and such too? Wonder what WinCVS does (about .cvsrc, the ! right thing for a GUI is to just store the password in ! memory only)... */ ! error (1, 0, "could not find out home directory"); return (char *) NULL; } Index: wrapper.c =================================================================== RCS file: /home2/cvsroot/ccvs/src/wrapper.c,v retrieving revision 1.23 diff -c -r1.23 wrapper.c *** wrapper.c 1998/05/20 16:39:13 1.23 --- wrapper.c 1998/07/22 18:31:03 *************** *** 118,123 **** --- 118,128 ---- /* Then add entries found in home dir, (if user has one) and file exists. */ homedir = get_homedir (); + /* If we can't find a home directory, ignore ~/.cvswrappers. This may + make tracking down problems a bit of a pain, but on the other + hand it might be obnoxious to complain when CVS will function + just fine without .cvswrappers (and many users won't even know what + .cvswrappers is). */ if (homedir != NULL) { char *file;