summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Francois Brousseau <jfb@cvs.openbsd.org>2004-08-12 21:03:47 +0000
committerJean-Francois Brousseau <jfb@cvs.openbsd.org>2004-08-12 21:03:47 +0000
commit5990963ba5262ca2f6f52fa45671e1d143fbe28e (patch)
tree38846aae850154fc6e679ae4b1e9286246847014
parent4ba770f5ac9bcfbed1f43298c2fa61f43c93b9e4 (diff)
Add error checking and move the protocol calls so we only send them if
the cvs server is remote
-rw-r--r--usr.bin/cvs/checkout.c27
1 files changed, 16 insertions, 11 deletions
diff --git a/usr.bin/cvs/checkout.c b/usr.bin/cvs/checkout.c
index bc6803994a1..6112d9104d2 100644
--- a/usr.bin/cvs/checkout.c
+++ b/usr.bin/cvs/checkout.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: checkout.c,v 1.8 2004/08/06 13:08:39 jfb Exp $ */
+/* $OpenBSD: checkout.c,v 1.9 2004/08/12 21:03:46 jfb Exp $ */
/*
* Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org>
* All rights reserved.
@@ -69,21 +69,26 @@ cvs_checkout(int argc, char **argv)
return (EX_USAGE);
}
- cvs_files = cvs_file_get(".", CF_IGNORE);
+ cvs_files = cvs_file_get(".", 0);
+ if (cvs_files == NULL)
+ return (EX_DATAERR);
+
root = CVS_DIR_ROOT(cvs_files);
if (root->cr_method != CVS_METHOD_LOCAL) {
cvs_connect(root);
- }
- cvs_sendarg(root, argv[0], 0);
- cvs_senddir(root, cvs_files);
- cvs_sendreq(root, CVS_REQ_XPANDMOD, NULL);
+ if ((cvs_sendarg(root, argv[0], 0) < 0) ||
+ (cvs_senddir(root, cvs_files) < 0) ||
+ (cvs_sendreq(root, CVS_REQ_XPANDMOD, NULL) < 0))
+ cvs_log(LP_ERR, "failed to expand module");
- /* XXX not too sure why we have to send this arg */
- cvs_sendarg(root, "-N", 0);
- cvs_sendarg(root, argv[0], 0);
- cvs_senddir(root, cvs_files);
- cvs_sendreq(root, CVS_REQ_CO, NULL);
+ /* XXX not too sure why we have to send this arg */
+ if ((cvs_sendarg(root, "-N", 0) < 0) ||
+ (cvs_sendarg(root, argv[0], 0) < 0) ||
+ (cvs_senddir(root, cvs_files) < 0) ||
+ (cvs_sendreq(root, CVS_REQ_CO, NULL) < 0))
+ cvs_log(LP_ERR, "failed to checkout");
+ }
return (0);
}