summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRay Lai <ray@cvs.openbsd.org>2006-03-16 04:01:47 +0000
committerRay Lai <ray@cvs.openbsd.org>2006-03-16 04:01:47 +0000
commit2f3b113bf98f757cf799839e4ec195a00579a2be (patch)
treef7aef0b0ede953a555fe3f306b3105d244761ef7
parentc379d0232c329e29cf8319b6be8f8b7ed30b373a (diff)
Currently co(1) overwrites files that the current user doesn't have
write permissions for. If you own the directory, that means your existing file, mode 000, is blown away without prompting you. GNU RCS does this as well. This fixes changes co(1) to always prompt if a file exists. This breaks GNU compatibility but I think it's more important that we prevent co(1) from overwriting files with strict permissions without even prompting. ``makes sense'' xsa to an earlier diff
-rw-r--r--usr.bin/rcs/co.c34
1 files changed, 17 insertions, 17 deletions
diff --git a/usr.bin/rcs/co.c b/usr.bin/rcs/co.c
index f676c54ac5c..3700c99f60e 100644
--- a/usr.bin/rcs/co.c
+++ b/usr.bin/rcs/co.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: co.c,v 1.60 2006/03/15 20:00:50 niallo Exp $ */
+/* $OpenBSD: co.c,v 1.61 2006/03/16 04:01:46 ray Exp $ */
/*
* Copyright (c) 2005 Joris Vink <joris@openbsd.org>
* All rights reserved.
@@ -340,23 +340,23 @@ checkout_rev(RCSFILE *file, RCSNUM *frev, const char *dst, int flags,
}
if ((pipeout == 0) && (stat(dst, &st) == 0) && !(flags & FORCE)) {
- if (st.st_mode & S_IWUSR) {
- if (verbose == 0) {
- cvs_log(LP_ERR,
- "writable %s exists; checkout aborted",
- dst);
- return (-1);
- }
+ if (verbose == 0) {
+ cvs_log(LP_ERR,
+ "writable %s exists; checkout aborted",
+ dst);
+ return (-1);
+ }
- printf("writable %s exists%s; ", dst,
- (getuid() == st.st_uid) ? "" :
- ", and you do not own it");
- printf("remove it? [ny](n): ");
- /* default is n */
- if (cvs_yesno() == -1) {
- cvs_log(LP_ERR, "checkout aborted");
- return (-1);
- }
+ if (st.st_mode & S_IWUSR)
+ printf("writable ");
+ printf("%s exists%s; ", dst,
+ (getuid() == st.st_uid) ? "" :
+ ", and you do not own it");
+ printf("remove it? [ny](n): ");
+ /* default is n */
+ if (cvs_yesno() == -1) {
+ cvs_log(LP_ERR, "checkout aborted");
+ return (-1);
}
}