summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoris Vink <joris@cvs.openbsd.org>2006-05-27 18:18:07 +0000
committerJoris Vink <joris@cvs.openbsd.org>2006-05-27 18:18:07 +0000
commit94f6d0490363df1900a6994c25f0634dcb3884d1 (patch)
treeb958944d93b494b491f674426d47ce3ed657d6ab
parentffddf9a1bc28161212c40982c80bb2fdeeec0d36 (diff)
lets be nice and abort cvs when we find out there is
no CVSROOT directory where there is suppose to be one.
-rw-r--r--usr.bin/cvs/cvs.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/usr.bin/cvs/cvs.c b/usr.bin/cvs/cvs.c
index 8f4400467a6..183aa6a01b4 100644
--- a/usr.bin/cvs/cvs.c
+++ b/usr.bin/cvs/cvs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cvs.c,v 1.99 2006/05/27 18:04:46 joris Exp $ */
+/* $OpenBSD: cvs.c,v 1.100 2006/05/27 18:18:06 joris Exp $ */
/*
* Copyright (c) 2006 Joris Vink <joris@openbsd.org>
* Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org>
@@ -115,6 +115,7 @@ main(int argc, char **argv)
struct cvs_cmd *cmdp;
struct passwd *pw;
struct stat st;
+ char fpath[MAXPATHLEN];
tzset();
@@ -226,6 +227,21 @@ main(int argc, char **argv)
if (current_cvsroot->cr_method != CVS_METHOD_LOCAL)
fatal("remote setups are not supported yet");
+ i = snprintf(fpath, sizeof(fpath), "%s/%s", current_cvsroot->cr_dir,
+ CVS_PATH_ROOT);
+ if (stat(fpath, &st) == -1) {
+ if (errno == ENOENT)
+ fatal("'%s' does not seem to be a valid repository",
+ current_cvsroot->cr_dir);
+ else
+ fatal("%s: %s", current_cvsroot->cr_dir,
+ strerror(errno));
+ } else {
+ if (!S_ISDIR(st.st_mode))
+ fatal("'%s' is not a directory",
+ current_cvsroot->cr_dir);
+ }
+
cvs_parse_configfile();
umask(cvs_umask);