summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Francois Brousseau <jfb@cvs.openbsd.org>2004-12-14 01:11:52 +0000
committerJean-Francois Brousseau <jfb@cvs.openbsd.org>2004-12-14 01:11:52 +0000
commit2ca695ed5de067a4faaef2051d2531cfde2aab68 (patch)
tree8cc86247d1c67cc55e1997718a685288cdb982c3
parent22376c36bc30ffc86db8e464f148f70b25255774 (diff)
cleaner error handling on connection setup and in case of connection
failure
-rw-r--r--usr.bin/cvs/checkout.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/usr.bin/cvs/checkout.c b/usr.bin/cvs/checkout.c
index 30d96494d0e..63280bf8592 100644
--- a/usr.bin/cvs/checkout.c
+++ b/usr.bin/cvs/checkout.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: checkout.c,v 1.11 2004/12/07 17:10:56 tedu Exp $ */
+/* $OpenBSD: checkout.c,v 1.12 2004/12/14 01:11:51 jfb Exp $ */
/*
* Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org>
* All rights reserved.
@@ -70,10 +70,8 @@ cvs_checkout(int argc, char **argv)
return (EX_USAGE);
}
- cvs_files = cvs_file_get(".", 0);
- if (cvs_files == NULL) {
+ if ((cvs_files = cvs_file_get(".", 0)) == NULL)
return (EX_USAGE);
- }
root = CVS_DIR_ROOT(cvs_files);
if (root == NULL) {
@@ -84,7 +82,8 @@ cvs_checkout(int argc, char **argv)
return (EX_USAGE);
}
if (root->cr_method != CVS_METHOD_LOCAL) {
- cvs_connect(root);
+ if (cvs_connect(root) < 0)
+ return (EX_DATAERR);
/* first send the expand modules command */
for (i = 0; i < argc; i++)
@@ -97,15 +96,16 @@ cvs_checkout(int argc, char **argv)
/* XXX not too sure why we have to send this arg */
if (cvs_sendarg(root, "-N", 0) < 0)
- exit(1);
+ return (EX_PROTOCOL);
for (i = 0; i < argc; i++)
if (cvs_sendarg(root, argv[i], 0) < 0)
- exit(EX_OSERR);
+ return (EX_PROTOCOL);
if ((cvs_senddir(root, cvs_files) < 0) ||
(cvs_sendreq(root, CVS_REQ_CO, NULL) < 0)) {
cvs_log(LP_ERR, "failed to checkout");
+ return (EX_PROTOCOL);
}
}