summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjfb <jfb@openbsd.org>2005-01-31 21:46:43 +0000
committerjfb <jfb@openbsd.org>2005-01-31 21:46:43 +0000
commitea00a281d31007c4e723678811b4128331d64bb1 (patch)
tree7bbe3c3afd407795ec6c34ece0a2842e6fdfe1bc
parentspaces (diff)
downloadwireguard-openbsd-ea00a281d31007c4e723678811b4128331d64bb1.tar.xz
wireguard-openbsd-ea00a281d31007c4e723678811b4128331d64bb1.zip
don't crash if we have no valid CVSROOT string
-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);