summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorxsa <xsa@openbsd.org>2005-04-21 18:54:50 +0000
committerxsa <xsa@openbsd.org>2005-04-21 18:54:50 +0000
commit7d2775b6dbdab6b131223c21eccb89448123df57 (patch)
tree5f56d6d85a33a6ef4e559f28dd898cfde835e5fc
parentCorrectly handle allocations of size 1 at an extent boundary; from NetBSD. (diff)
downloadwireguard-openbsd-7d2775b6dbdab6b131223c21eccb89448123df57.tar.xz
wireguard-openbsd-7d2775b6dbdab6b131223c21eccb89448123df57.zip
add checks for files still physically present that should be removed;
input/ok joris
-rw-r--r--usr.bin/cvs/remove.c26
1 files changed, 17 insertions, 9 deletions
diff --git a/usr.bin/cvs/remove.c b/usr.bin/cvs/remove.c
index e79ec0f26de..51fb1be6a0f 100644
--- a/usr.bin/cvs/remove.c
+++ b/usr.bin/cvs/remove.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: remove.c,v 1.9 2005/04/19 15:36:39 xsa Exp $ */
+/* $OpenBSD: remove.c,v 1.10 2005/04/21 18:54:50 xsa Exp $ */
/*
* Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org>
* Copyright (c) 2004 Xavier Santolaria <xsa@openbsd.org>
@@ -52,7 +52,7 @@ struct cvs_cmd_info cvs_remove = {
NULL,
cvs_remove_file,
NULL, NULL,
- 0,
+ CF_IGNORE | CF_RECURSE,
CVS_REQ_REMOVE,
CVS_CMD_SENDDIR | CVS_CMD_SENDARGS2 | CVS_CMD_ALLOWSPEC
};
@@ -114,20 +114,28 @@ cvs_remove_file(CVSFILE *cf, void *arg)
cvs_file_getpath(cf, fpath, sizeof(fpath));
if (root->cr_method != CVS_METHOD_LOCAL) {
- if (cvs_sendentry(root, cf) < 0) {
- return (CVS_EX_PROTO);
- }
-
- } else {
/* if -f option is used, physically remove the file */
if (force_remove == 1) {
if((unlink(fpath) == -1) && (errno != ENOENT)) {
- cvs_log(LP_ERRNO, "failed to unlink `%s'",
- fpath);
+ cvs_log(LP_ERRNO,
+ "failed to unlink `%s'", fpath);
return (CVS_EX_FILE);
}
}
+ if (cvs_sendentry(root, cf) < 0)
+ return (CVS_EX_PROTO);
+
+ if (cf->cf_cvstat != CVS_FST_LOST && force_remove != 1) {
+ if (cvs_sendreq(root, CVS_REQ_MODIFIED,
+ CVS_FILE_NAME(cf)) < 0) {
+ return (CVS_EX_PROTO);
+ }
+ }
+
+ if (cvs_sendfile(root, fpath) < 0)
+ return (CVS_EX_PROTO);
+ } else {
cvs_log(LP_INFO, "scheduling file `%s' for removal",
CVS_FILE_NAME(cf));
cvs_log(LP_INFO,