diff options
author | Tobias Stoeckmann <tobias@cvs.openbsd.org> | 2007-09-07 23:30:31 +0000 |
---|---|---|
committer | Tobias Stoeckmann <tobias@cvs.openbsd.org> | 2007-09-07 23:30:31 +0000 |
commit | 87dd5abad3eefefc93c8f8c66158a072d735125e (patch) | |
tree | 644fad1348d5d216da275aae1fa715589b19c631 /usr.bin | |
parent | c7f0016390151b0e6c26e445ec857ba21f0a5d42 (diff) |
Do not fatal if getpwuid() fails, instead ignore user configuration files.
OK joris@
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/cvs/cvs.c | 10 | ||||
-rw-r--r-- | usr.bin/cvs/file.c | 5 |
2 files changed, 9 insertions, 6 deletions
diff --git a/usr.bin/cvs/cvs.c b/usr.bin/cvs/cvs.c index 7e2a2923759..9d4c3270c00 100644 --- a/usr.bin/cvs/cvs.c +++ b/usr.bin/cvs/cvs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cvs.c,v 1.130 2007/09/02 12:13:00 tobias Exp $ */ +/* $OpenBSD: cvs.c,v 1.131 2007/09/07 23:30:30 tobias Exp $ */ /* * Copyright (c) 2006, 2007 Joris Vink <joris@openbsd.org> * Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org> @@ -157,9 +157,9 @@ main(int argc, char **argv) } if ((cvs_homedir = getenv("HOME")) == NULL) { - if ((pw = getpwuid(getuid())) == NULL) - fatal("getpwuid failed"); - cvs_homedir = pw->pw_dir; + if ((pw = getpwuid(getuid())) != NULL) + cvs_homedir = pw->pw_dir; + } if ((envstr = getenv("TMPDIR")) != NULL) @@ -184,7 +184,7 @@ main(int argc, char **argv) else if (!S_ISDIR(st.st_mode)) fatal("`%s' is not valid temporary directory", cvs_tmpdir); - if (cvs_readrc == 1) { + if (cvs_readrc == 1 && cvs_homedir != NULL) { cvs_read_rcfile(); if (cvs_defargs != NULL) { diff --git a/usr.bin/cvs/file.c b/usr.bin/cvs/file.c index 8bc2e82267c..ba15fcbea7e 100644 --- a/usr.bin/cvs/file.c +++ b/usr.bin/cvs/file.c @@ -1,4 +1,4 @@ -/* $OpenBSD: file.c,v 1.194 2007/07/03 13:22:42 joris Exp $ */ +/* $OpenBSD: file.c,v 1.195 2007/09/07 23:30:30 tobias Exp $ */ /* * Copyright (c) 2006 Joris Vink <joris@openbsd.org> * Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org> @@ -88,6 +88,9 @@ cvs_file_init(void) for (i = 0; i < (int)(sizeof(cvs_ign_std)/sizeof(char *)); i++) cvs_file_ignore(cvs_ign_std[i], &cvs_ign_pats); + if (cvs_homedir == NULL) + return; + /* read the cvsignore file in the user's home directory, if any */ (void)xsnprintf(path, MAXPATHLEN, "%s/.cvsignore", cvs_homedir); |