summaryrefslogtreecommitdiffstats
path: root/usr.bin/rcs
diff options
context:
space:
mode:
authorjoris <joris@openbsd.org>2020-06-09 20:05:40 +0000
committerjoris <joris@openbsd.org>2020-06-09 20:05:40 +0000
commit14470f30fda92319e3a0f1a69e4be15edc71dcdf (patch)
tree27077fb23da77fcf70fba69352e5808bea6991b4 /usr.bin/rcs
parentImplement intr_enable(), intr_disable() and intr_restore(). (diff)
downloadwireguard-openbsd-14470f30fda92319e3a0f1a69e4be15edc71dcdf.tar.xz
wireguard-openbsd-14470f30fda92319e3a0f1a69e4be15edc71dcdf.zip
Refuse to remove locked revisions with rcs -orange.
Otherwise we could leave behind a lock for a revision that no longer exists, breaking the RCS file. Reported via bugs@ by bernward.pub@arcor.de
Diffstat (limited to 'usr.bin/rcs')
-rw-r--r--usr.bin/rcs/rcsprog.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/usr.bin/rcs/rcsprog.c b/usr.bin/rcs/rcsprog.c
index 0a14b8a19b3..686275bc6d8 100644
--- a/usr.bin/rcs/rcsprog.c
+++ b/usr.bin/rcs/rcsprog.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rcsprog.c,v 1.161 2016/07/04 01:39:12 millert Exp $ */
+/* $OpenBSD: rcsprog.c,v 1.162 2020/06/09 20:05:40 joris Exp $ */
/*
* Copyright (c) 2005 Jean-Francois Brousseau <jfb@openbsd.org>
* All rights reserved.
@@ -518,6 +518,14 @@ rcs_main(int argc, char **argv)
*/
if (rdp->rd_flags & RCS_RD_SELECT) {
rcsnum_tostr(rdp->rd_num, b, sizeof(b));
+
+ if (rdp->rd_locker != NULL) {
+ errx(1, "%s: can't remove "
+ "locked revision %s",
+ fpath, b);
+ continue;
+ }
+
if (!(rcsflags & QUIET)) {
(void)fprintf(stderr, "deleting"
" revision %s\n", b);