summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--usr.bin/cvs/add.c5
-rw-r--r--usr.bin/cvs/admin.c10
-rw-r--r--usr.bin/cvs/annotate.c9
-rw-r--r--usr.bin/cvs/commit.c12
-rw-r--r--usr.bin/cvs/diff.c4
-rw-r--r--usr.bin/cvs/getlog.c6
-rw-r--r--usr.bin/cvs/import.c15
-rw-r--r--usr.bin/cvs/release.c18
-rw-r--r--usr.bin/cvs/remove.c5
-rw-r--r--usr.bin/cvs/server.c6
-rw-r--r--usr.bin/cvs/status.c21
-rw-r--r--usr.bin/cvs/tag.c12
-rw-r--r--usr.bin/cvs/update.c10
13 files changed, 85 insertions, 48 deletions
diff --git a/usr.bin/cvs/add.c b/usr.bin/cvs/add.c
index 33152ae090d..e9f8832c370 100644
--- a/usr.bin/cvs/add.c
+++ b/usr.bin/cvs/add.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: add.c,v 1.19 2005/04/12 14:58:40 joris Exp $ */
+/* $OpenBSD: add.c,v 1.20 2005/05/20 20:00:53 joris Exp $ */
/*
* Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org>
* All rights reserved.
@@ -119,6 +119,9 @@ cvs_add_file(CVSFILE *cf, void *arg)
if (root->cr_method != CVS_METHOD_LOCAL)
ret = cvs_senddir(root, cf);
+ if (ret == -1)
+ ret = CVS_EX_PROTO;
+
return (ret);
}
diff --git a/usr.bin/cvs/admin.c b/usr.bin/cvs/admin.c
index 9b3767cdf9e..02a596ffb0e 100644
--- a/usr.bin/cvs/admin.c
+++ b/usr.bin/cvs/admin.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: admin.c,v 1.13 2005/04/18 21:02:49 jfb Exp $ */
+/* $OpenBSD: admin.c,v 1.14 2005/05/20 20:00:53 joris Exp $ */
/*
* Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org>
* Copyright (c) 2005 Joris Vink <joris@openbsd.org>
@@ -312,6 +312,9 @@ cvs_admin_file(CVSFILE *cfp, void *arg)
CVS_FILE_NAME(cfp));
else
ret = cvs_senddir(root, cfp);
+
+ if (ret == -1)
+ ret = CVS_EX_PROTO;
}
return (ret);
@@ -341,6 +344,9 @@ cvs_admin_file(CVSFILE *cfp, void *arg)
default:
break;
}
+
+ if (ret == -1)
+ ret = CVS_EX_PROTO;
} else {
if (cfp->cf_cvstat == CVS_FST_UNKNOWN) {
cvs_log(LP_WARN, "I know nothing about %s", fpath);
@@ -352,7 +358,7 @@ cvs_admin_file(CVSFILE *cfp, void *arg)
if (l == -1 || l >= (int)sizeof(rcspath)) {
errno = ENAMETOOLONG;
cvs_log(LP_ERRNO, "%s", rcspath);
- return (-1);
+ return (CVS_EX_DATA);
}
rf = rcs_open(rcspath, RCS_READ);
diff --git a/usr.bin/cvs/annotate.c b/usr.bin/cvs/annotate.c
index cff6c33ff5e..b92bbfca039 100644
--- a/usr.bin/cvs/annotate.c
+++ b/usr.bin/cvs/annotate.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: annotate.c,v 1.12 2005/05/20 18:32:23 jfb Exp $ */
+/* $OpenBSD: annotate.c,v 1.13 2005/05/20 20:00:53 joris Exp $ */
/*
* Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org>
* All rights reserved.
@@ -140,6 +140,10 @@ cvs_annotate_file(CVSFILE *cf, void *arg)
cf->cf_name);
else
ret = cvs_senddir(root, cf);
+
+ if (ret == -1)
+ ret = CVS_EX_PROTO;
+
return (ret);
}
@@ -164,5 +168,8 @@ cvs_annotate_file(CVSFILE *cf, void *arg)
break;
}
+ if (ret == -1)
+ ret = CVS_EX_PROTO;
+
return (ret);
}
diff --git a/usr.bin/cvs/commit.c b/usr.bin/cvs/commit.c
index a4474608c3f..9ed4fc7f4ec 100644
--- a/usr.bin/cvs/commit.c
+++ b/usr.bin/cvs/commit.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: commit.c,v 1.32 2005/05/20 05:13:44 joris Exp $ */
+/* $OpenBSD: commit.c,v 1.33 2005/05/20 20:00:53 joris Exp $ */
/*
* Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org>
* All rights reserved.
@@ -198,11 +198,13 @@ cvs_commit_file(CVSFILE *cf, void *arg)
if (cf->cf_type == DT_DIR) {
if (root->cr_method != CVS_METHOD_LOCAL) {
- if (cf->cf_cvstat != CVS_FST_UNKNOWN)
- ret = cvs_senddir(root, cf);
+ if (cf->cf_cvstat != CVS_FST_UNKNOWN) {
+ if (cvs_senddir(root, cf) < 0)
+ return (CVS_EX_PROTO);
+ }
}
- return (ret);
+ return (0);
}
cvs_file_getpath(cf, fpath, sizeof(fpath));
@@ -241,7 +243,7 @@ cvs_commit_file(CVSFILE *cf, void *arg)
if (l == -1 || l >= (int)sizeof(rcspath)) {
errno = ENAMETOOLONG;
cvs_log(LP_ERRNO, "%s", rcspath);
- return (-1);
+ return (CVS_EX_DATA);
}
return (0);
diff --git a/usr.bin/cvs/diff.c b/usr.bin/cvs/diff.c
index 29f013c0c3b..a1b7e76af9f 100644
--- a/usr.bin/cvs/diff.c
+++ b/usr.bin/cvs/diff.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: diff.c,v 1.33 2005/04/25 19:09:15 jfb Exp $ */
+/* $OpenBSD: diff.c,v 1.34 2005/05/20 20:00:53 joris Exp $ */
/*
* Copyright (C) Caldera International Inc. 2001-2002.
* All rights reserved.
@@ -564,7 +564,7 @@ cvs_diff_file(struct cvs_file *cfp, void *arg)
if (l == -1 || l >= (int)sizeof(rcspath)) {
errno = ENAMETOOLONG;
cvs_log(LP_ERRNO, "%s", rcspath);
- return (-1);
+ return (CVS_EX_DATA);
}
rf = rcs_open(rcspath, RCS_READ);
diff --git a/usr.bin/cvs/getlog.c b/usr.bin/cvs/getlog.c
index 6f2d9a5c013..39c2ff9bcba 100644
--- a/usr.bin/cvs/getlog.c
+++ b/usr.bin/cvs/getlog.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: getlog.c,v 1.27 2005/05/20 16:57:31 jfb Exp $ */
+/* $OpenBSD: getlog.c,v 1.28 2005/05/20 20:00:53 joris Exp $ */
/*
* Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org>
* All rights reserved.
@@ -205,7 +205,7 @@ cvs_getlog_local(CVSFILE *cf, void *arg)
if (l == -1 || l >= (int)sizeof(rcspath)) {
errno = ENAMETOOLONG;
cvs_log(LP_ERRNO, "%s", rcspath);
- return (-1);
+ return (CVS_EX_DATA);
}
if (log_rfonly) {
@@ -215,7 +215,7 @@ cvs_getlog_local(CVSFILE *cf, void *arg)
rf = rcs_open(rcspath, RCS_READ);
if (rf == NULL)
- return (-1);
+ return (CVS_EX_DATA);
cvs_printf("\nRCS file: %s\nWorking file: %s\n", rcspath, cf->cf_name);
cvs_printf("head: %s\n",
diff --git a/usr.bin/cvs/import.c b/usr.bin/cvs/import.c
index ec23cb6f26d..1b576804817 100644
--- a/usr.bin/cvs/import.c
+++ b/usr.bin/cvs/import.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: import.c,v 1.13 2005/04/25 16:29:41 jfb Exp $ */
+/* $OpenBSD: import.c,v 1.14 2005/05/20 20:00:53 joris Exp $ */
/*
* Copyright (c) 2004 Joris Vink <joris@openbsd.org>
* All rights reserved.
@@ -141,7 +141,7 @@ cvs_import_sendflags(struct cvsroot *root)
int
cvs_import_file(CVSFILE *cfp, void *arg)
{
- int ret, l;
+ int l;
struct cvsroot *root;
char fpath[MAXPATHLEN], repodir[MAXPATHLEN];
char repo[MAXPATHLEN];
@@ -151,7 +151,7 @@ cvs_import_file(CVSFILE *cfp, void *arg)
if (l == -1 || l >= (int)sizeof(repo)) {
errno = ENAMETOOLONG;
cvs_log(LP_ERRNO, "%s", repo);
- return (-1);
+ return (CVS_EX_DATA);
}
cvs_file_getpath(cfp, fpath, sizeof(fpath));
@@ -166,13 +166,14 @@ cvs_import_file(CVSFILE *cfp, void *arg)
if (l == -1 || l >= (int)sizeof(repodir)) {
errno = ENAMETOOLONG;
cvs_log(LP_ERRNO, "%s", repodir);
- return (-1);
+ return (CVS_EX_DATA);
}
}
if (root->cr_method != CVS_METHOD_LOCAL) {
- ret = cvs_sendreq(root, CVS_REQ_DIRECTORY, fpath);
- if (ret == 0)
- ret = cvs_sendln(root, repodir);
+ if (cvs_sendreq(root, CVS_REQ_DIRECTORY, fpath) < 0)
+ return (CVS_EX_PROTO);
+ if (cvs_sendln(root, repodir) < 0)
+ return (CVS_EX_PROTO);
} else {
/* create the directory */
}
diff --git a/usr.bin/cvs/release.c b/usr.bin/cvs/release.c
index ddecdec9e1d..ce6ee75b0ef 100644
--- a/usr.bin/cvs/release.c
+++ b/usr.bin/cvs/release.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: release.c,v 1.5 2005/05/19 22:07:33 jfb Exp $ */
+/* $OpenBSD: release.c,v 1.6 2005/05/20 20:00:53 joris Exp $ */
/*
* Copyright (c) 2005 Xavier Santolaria <xsa@openbsd.org>
* All rights reserved.
@@ -145,7 +145,7 @@ cvs_release_dir(CVSFILE *cdir, void *arg)
if (l == -1 || l >= (int)sizeof(cdpath)) {
errno = ENAMETOOLONG;
cvs_log(LP_ERRNO, "%s", cdpath);
- return (-1);
+ return (CVS_EX_DATA);
}
if (cdir->cf_type == DT_DIR) {
@@ -170,20 +170,20 @@ cvs_release_dir(CVSFILE *cdir, void *arg)
if (chdir(dpath) == -1) {
cvs_log(LP_ERRNO, "cannot change to dir `%s'",
dpath);
- return (-1);
+ return (CVS_EX_FILE);
}
/* construct `cvs update' command */
l = snprintf(updcmd, sizeof(updcmd), "%s %s %s update",
__progname, UPDCMD_FLAGS, root->cr_str);
if (l == -1 || l >= (int)sizeof(updcmd))
- return (-1);
+ return (CVS_EX_DATA);
/* XXX we should try to avoid a new connection ... */
if ((fp = popen(updcmd, "r")) == NULL) {
cvs_log(LP_ERROR, "cannot run command `%s'",
updcmd);
- return (-1);
+ return (CVS_EX_DATA);
}
while (fgets(buf, sizeof(buf), fp) != NULL) {
@@ -195,7 +195,7 @@ cvs_release_dir(CVSFILE *cdir, void *arg)
if (pclose(fp) != 0) {
cvs_log(LP_ERROR, "unable to release `%s'",
dpath);
- return (-1);
+ return (CVS_EX_DATA);
}
printf("You have [%d] altered file%s in this "
@@ -216,7 +216,7 @@ cvs_release_dir(CVSFILE *cdir, void *arg)
if (chdir(wdir) == -1) {
cvs_log(LP_ERRNO, "cannot change to original "
"working dir `%s'", wdir);
- return (-1);
+ return (CVS_EX_FILE);
}
if (dflag == 1) {
@@ -224,13 +224,13 @@ cvs_release_dir(CVSFILE *cdir, void *arg)
cvs_log(LP_ERRNO,
"deletion of directory `%s' failed",
dpath);
- return (-1);
+ return (CVS_EX_FILE);
}
}
}
} else {
cvs_log(LP_ERR, "no such directory: %s", dpath);
- return (-1);
+ return (CVS_EX_DATA);
}
return (0);
diff --git a/usr.bin/cvs/remove.c b/usr.bin/cvs/remove.c
index 370c51dc98e..44090d881e6 100644
--- a/usr.bin/cvs/remove.c
+++ b/usr.bin/cvs/remove.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: remove.c,v 1.14 2005/05/20 19:58:03 xsa Exp $ */
+/* $OpenBSD: remove.c,v 1.15 2005/05/20 20:00:53 joris Exp $ */
/*
* Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org>
* Copyright (c) 2004 Xavier Santolaria <xsa@openbsd.org>
@@ -103,6 +103,9 @@ cvs_remove_file(CVSFILE *cf, void *arg)
CVS_FILE_NAME(cf));
else
ret = cvs_senddir(root, cf);
+
+ if (ret == -1)
+ ret = CVS_EX_PROTO;
}
return (ret);
diff --git a/usr.bin/cvs/server.c b/usr.bin/cvs/server.c
index 30207f99f90..1ac0de6f16e 100644
--- a/usr.bin/cvs/server.c
+++ b/usr.bin/cvs/server.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: server.c,v 1.15 2005/05/18 21:39:25 alek Exp $ */
+/* $OpenBSD: server.c,v 1.16 2005/05/20 20:00:53 joris Exp $ */
/*
* Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org>
* All rights reserved.
@@ -88,13 +88,13 @@ cvs_server(int argc, char **argv)
if (mkdir(cvs_server_tmpdir, 0700) == -1) {
cvs_log(LP_ERRNO, "failed to create temporary directory '%s'",
cvs_server_tmpdir);
- return (CVS_EX_DATA);
+ return (CVS_EX_FILE);
}
if (chdir(cvs_server_tmpdir) == -1) {
cvs_log(LP_ERRNO, "failed to change to temporary directory '%s'",
cvs_server_tmpdir);
- return (CVS_EX_DATA);
+ return (CVS_EX_FILE);
}
for (;;) {
diff --git a/usr.bin/cvs/status.c b/usr.bin/cvs/status.c
index 1c60155302b..6c0cf14a37b 100644
--- a/usr.bin/cvs/status.c
+++ b/usr.bin/cvs/status.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: status.c,v 1.20 2005/04/27 04:54:46 jfb Exp $ */
+/* $OpenBSD: status.c,v 1.21 2005/05/20 20:00:53 joris Exp $ */
/*
* Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org>
* All rights reserved.
@@ -129,14 +129,17 @@ cvs_status_remote(CVSFILE *cfp, void *arg)
CVS_FILE_NAME(cfp));
else
ret = cvs_senddir(root, cfp);
+
+ if (ret == -1)
+ ret = CVS_EX_PROTO;
+
return (ret);
}
cvs_file_getpath(cfp, fpath, sizeof(fpath));
- if (cvs_sendentry(root, cfp) < 0) {
- return (-1);
- }
+ if (cvs_sendentry(root, cfp) < 0)
+ return (CVS_EX_PROTO);
switch (cfp->cf_cvstat) {
case CVS_FST_UNKNOWN:
@@ -154,6 +157,9 @@ cvs_status_remote(CVSFILE *cfp, void *arg)
break;
}
+ if (ret == -1)
+ ret = CVS_EX_PROTO;
+
return (ret);
}
@@ -183,13 +189,12 @@ cvs_status_local(CVSFILE *cfp, void *arg)
if (l == -1 || l >= (int)sizeof(rcspath)) {
errno = ENAMETOOLONG;
cvs_log(LP_ERRNO, "%s", rcspath);
- return (-1);
+ return (CVS_EX_DATA);
}
rf = rcs_open(rcspath, RCS_READ);
- if (rf == NULL) {
- return (-1);
- }
+ if (rf == NULL)
+ return (CVS_EX_DATA);
buf[0] = '\0';
if (cfp->cf_cvstat == CVS_FST_LOST)
diff --git a/usr.bin/cvs/tag.c b/usr.bin/cvs/tag.c
index 651fc76863c..8c6eb5eb376 100644
--- a/usr.bin/cvs/tag.c
+++ b/usr.bin/cvs/tag.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tag.c,v 1.15 2005/04/20 23:11:30 jfb Exp $ */
+/* $OpenBSD: tag.c,v 1.16 2005/05/20 20:00:53 joris Exp $ */
/*
* Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org>
* Copyright (c) 2004 Joris Vink <joris@openbsd.org>
@@ -174,7 +174,8 @@ cvs_tag_remote(CVSFILE *cfp, void *arg)
root = CVS_DIR_ROOT(cfp);
if (cfp->cf_type == DT_DIR) {
- ret = cvs_senddir(root, cfp);
+ if (cvs_senddir(root, cfp) < 0)
+ ret = CVS_EX_PROTO;
return (ret);
}
@@ -197,6 +198,9 @@ cvs_tag_remote(CVSFILE *cfp, void *arg)
break;
}
+ if (ret == -1)
+ ret = CVS_EX_PROTO;
+
return (ret);
}
@@ -225,14 +229,14 @@ cvs_tag_local(CVSFILE *cf, void *arg)
if (len == -1 || len >= (int)sizeof(rcspath)) {
errno = ENAMETOOLONG;
cvs_log(LP_ERRNO, "%s", rcspath);
- return (-1);
+ return (CVS_EX_DATA);
}
rf = rcs_open(rcspath, RCS_READ|RCS_WRITE);
if (rf == NULL) {
cvs_log(LP_ERR, "failed to open %s: %s", rcspath,
rcs_errstr(rcs_errno));
- return (-1);
+ return (CVS_EX_DATA);
}
if (rcs_sym_add(rf, tag_name, tag_rev) < 0) {
diff --git a/usr.bin/cvs/update.c b/usr.bin/cvs/update.c
index cb66036c97e..06138063ff1 100644
--- a/usr.bin/cvs/update.c
+++ b/usr.bin/cvs/update.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: update.c,v 1.27 2005/05/20 18:26:49 xsa Exp $ */
+/* $OpenBSD: update.c,v 1.28 2005/05/20 20:00:53 joris Exp $ */
/*
* Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org>
* All rights reserved.
@@ -138,6 +138,9 @@ cvs_update_remote(CVSFILE *cf, void *arg)
else
ret = cvs_senddir(root, cf);
+ if (ret == -1)
+ ret = CVS_EX_PROTO;
+
return (ret);
}
@@ -163,6 +166,9 @@ cvs_update_remote(CVSFILE *cf, void *arg)
break;
}
+ if (ret == -1)
+ ret = CVS_EX_PROTO;
+
return (ret);
}
@@ -198,7 +204,7 @@ cvs_update_local(CVSFILE *cf, void *arg)
if (l == -1 || l >= (int)sizeof(rcspath)) {
errno = ENAMETOOLONG;
cvs_log(LP_ERRNO, "%s", rcspath);
- return (-1);
+ return (CVS_EX_DATA);
}
rf = rcs_open(rcspath, RCS_RDWR);