summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorXavier Santolaria <xsa@cvs.openbsd.org>2005-07-21 16:59:25 +0000
committerXavier Santolaria <xsa@cvs.openbsd.org>2005-07-21 16:59:25 +0000
commit7b57000879fd70136228b6fb2dbbda9f32c2e70d (patch)
tree2e2638d5001d9c697a52131ae4b2885b0b71f638 /usr.bin
parenta8b5a1b7407513fb795e4facf3a843d2b4a5767b (diff)
if the remove command is issued on a file that has been added but not
committed yet, remove CVS/<file>,t (in local mode); ok joris@.
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/cvs/remove.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/usr.bin/cvs/remove.c b/usr.bin/cvs/remove.c
index bdbccad13f5..4bd8ea6d8a6 100644
--- a/usr.bin/cvs/remove.c
+++ b/usr.bin/cvs/remove.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: remove.c,v 1.20 2005/07/20 06:59:27 xsa Exp $ */
+/* $OpenBSD: remove.c,v 1.21 2005/07/21 16:59:24 xsa Exp $ */
/*
* Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org>
* Copyright (c) 2004, 2005 Xavier Santolaria <xsa@openbsd.org>
@@ -141,8 +141,8 @@ cvs_remove_remote(CVSFILE *cf, void *arg)
static int
cvs_remove_local(CVSFILE *cf, void *arg)
{
- int existing, removed;
- char fpath[MAXPATHLEN];
+ int existing, l, removed;
+ char buf[MAXPATHLEN], fpath[MAXPATHLEN];
existing = removed = 0;
@@ -170,7 +170,17 @@ cvs_remove_local(CVSFILE *cf, void *arg)
cf->cf_name);
return (0);
} else if (cf->cf_cvstat == CVS_FST_ADDED) {
- /* XXX remove ,t file */
+ l = snprintf(buf, sizeof(buf), "%s/%s%s",
+ CVS_PATH_CVSDIR, cf->cf_name, CVS_DESCR_FILE_EXT);
+ if (l == -1 || l >= (int)sizeof(buf)) {
+ errno = ENAMETOOLONG;
+ cvs_log(LP_ERRNO, "%s", buf);
+ return (CVS_EX_DATA);
+ }
+ if (!cvs_noexec && (unlink(buf) == -1) && (errno != ENOENT)) {
+ cvs_log(LP_ERRNO, "cannot remove %s", buf);
+ return (CVS_EX_FILE);
+ }
if (verbosity > 1)
cvs_log(LP_INFO, "removed `%s'", cf->cf_name);
return (0);