summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorJean-Francois Brousseau <jfb@cvs.openbsd.org>2005-01-05 18:34:02 +0000
committerJean-Francois Brousseau <jfb@cvs.openbsd.org>2005-01-05 18:34:02 +0000
commitc84a5de0c006fa5a795f31bdb6c2784a7ca1311e (patch)
tree53080de73b94ec8c0cb0d76bec11ae850f1c39d0 /usr.bin
parentbeb25bc0f1b2a9a540ae8e91dbb133bf934b5e20 (diff)
Before attempting to initialize the cvs repository, make sure we have
a valid CVSROOT, and abort with the appropriate error message otherwise. Fixes a core dump spotted by jmc@
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/cvs/init.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/usr.bin/cvs/init.c b/usr.bin/cvs/init.c
index 53ece574b37..d053900b02b 100644
--- a/usr.bin/cvs/init.c
+++ b/usr.bin/cvs/init.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: init.c,v 1.8 2004/12/07 17:10:56 tedu Exp $ */
+/* $OpenBSD: init.c,v 1.9 2005/01/05 18:34:01 jfb Exp $ */
/*
* Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org>
* All rights reserved.
@@ -87,6 +87,14 @@ cvs_init(int argc, char **argv)
return (EX_USAGE);
root = cvsroot_get(".");
+ if (root == NULL) {
+ cvs_log(LP_ERR,
+ "No CVSROOT specified! Please use the `-d' option");
+ cvs_log(LP_ERR,
+ "or set the CVSROOT environment variable.");
+ return (EX_USAGE);
+ }
+
if (root->cr_method != CVS_METHOD_LOCAL) {
if (cvs_connect(root) < 0)
return (EX_DATAERR);