summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorray <ray@openbsd.org>2006-03-16 04:01:46 +0000
committerray <ray@openbsd.org>2006-03-16 04:01:46 +0000
commit7eb898e2a6cadbc708c13e109678a1b074998345 (patch)
tree72f9eb63317e11ec01fe76c0bfac3917e18a530c
parentQuiet, please. (diff)
downloadwireguard-openbsd-7eb898e2a6cadbc708c13e109678a1b074998345.tar.xz
wireguard-openbsd-7eb898e2a6cadbc708c13e109678a1b074998345.zip
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);
}
}