summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorJean-Francois Brousseau <jfb@cvs.openbsd.org>2005-01-31 21:46:44 +0000
committerJean-Francois Brousseau <jfb@cvs.openbsd.org>2005-01-31 21:46:44 +0000
commitb0b0ab3bf902ebb28c695f2ee2b6992467b22ee3 (patch)
tree2b7a0f012ea3221e7b4f62811e18b9e240a9edf3 /usr.bin
parentae26ae5e744b449891b99398f1e67e69f2b487e2 (diff)
don't crash if we have no valid CVSROOT string
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/cvs/history.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/usr.bin/cvs/history.c b/usr.bin/cvs/history.c
index 956e77811fa..72ae42783cd 100644
--- a/usr.bin/cvs/history.c
+++ b/usr.bin/cvs/history.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: history.c,v 1.5 2004/12/07 17:10:56 tedu Exp $ */
+/* $OpenBSD: history.c,v 1.6 2005/01/31 21:46:43 jfb Exp $ */
/*
* Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org>
* All rights reserved.
@@ -146,6 +146,13 @@ cvs_history(int argc, char **argv)
flags |= CVS_HF_O; /* use -o as default */
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) {
snprintf(histpath, sizeof(histpath), "%s/%s", root->cr_dir,
CVS_PATH_HISTORY);