summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Francois Brousseau <jfb@cvs.openbsd.org>2004-12-21 17:50:41 +0000
committerJean-Francois Brousseau <jfb@cvs.openbsd.org>2004-12-21 17:50:41 +0000
commit66c70c926b78caa8bed761baac88c10e22b66536 (patch)
tree00e639382a0086f0f4a0fc7fa512d7ea36c7fd86
parentb97728a5730a19a71786f817fc4950b7d6e67374 (diff)
Check to make sure we have a valid CVSROOT, and check the return value
when sending the add request
-rw-r--r--usr.bin/cvs/add.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/usr.bin/cvs/add.c b/usr.bin/cvs/add.c
index 9f506667742..7d3b9b13571 100644
--- a/usr.bin/cvs/add.c
+++ b/usr.bin/cvs/add.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: add.c,v 1.10 2004/12/21 16:48:39 xsa Exp $ */
+/* $OpenBSD: add.c,v 1.11 2004/12/21 17:50:40 jfb Exp $ */
/*
* Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org>
* All rights reserved.
@@ -83,7 +83,13 @@ cvs_add(int argc, char **argv)
return (EX_DATAERR);
root = CVS_DIR_ROOT(cvs_files);
-
+ 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) && (cvs_connect(root) < 0))
return (EX_PROTOCOL);
@@ -127,7 +133,7 @@ cvs_add_file(CVSFILE *cf, void *arg)
}
if (root->cr_method != CVS_METHOD_LOCAL) {
- cvs_sendreq(root, CVS_REQ_ADD, CVS_FILE_NAME(cf));
+ ret = cvs_sendreq(root, CVS_REQ_ADD, CVS_FILE_NAME(cf));
} else {
cvs_log(LP_INFO, "scheduling file `%s' for addition",
CVS_FILE_NAME(cf));