summaryrefslogtreecommitdiff
path: root/usr.bin/rcs
diff options
context:
space:
mode:
authorXavier Santolaria <xsa@cvs.openbsd.org>2005-11-30 18:50:52 +0000
committerXavier Santolaria <xsa@cvs.openbsd.org>2005-11-30 18:50:52 +0000
commit63c98683323184369669cc332c355ceb78e91ac4 (patch)
tree801d47937d057fa1c9a79725e4a415081fbc512f /usr.bin/rcs
parent886e859e39ba1fa3693c0f71146b8fc2909389e5 (diff)
check for ownership of already present writable file when checking out;
Diffstat (limited to 'usr.bin/rcs')
-rw-r--r--usr.bin/rcs/co.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/usr.bin/rcs/co.c b/usr.bin/rcs/co.c
index 279a773ad5e..8295171455c 100644
--- a/usr.bin/rcs/co.c
+++ b/usr.bin/rcs/co.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: co.c,v 1.40 2005/11/30 14:29:22 xsa Exp $ */
+/* $OpenBSD: co.c,v 1.41 2005/11/30 18:50:51 xsa Exp $ */
/*
* Copyright (c) 2005 Joris Vink <joris@openbsd.org>
* All rights reserved.
@@ -254,7 +254,7 @@ checkout_rev(RCSFILE *file, RCSNUM *frev, const char *dst, int flags,
if (verbose == 1)
printf("\n");
- if ((pipeout == 0) && (stat(dst, &st) != -1) && !(flags & FORCE)) {
+ if ((pipeout == 0) && (stat(dst, &st) == 0) && !(flags & FORCE)) {
if (st.st_mode & S_IWUSR) {
yn = 0;
if (verbose == 0) {
@@ -263,8 +263,11 @@ checkout_rev(RCSFILE *file, RCSNUM *frev, const char *dst, int flags,
dst);
return (-1);
}
- while (yn != 'y' && yn != 'n') {
- printf("writable %s exists; ", dst);
+
+ while ((yn != 'y') && (yn != 'n')) {
+ printf("writable %s exists%s; ", dst,
+ ((uid_t)getuid() == st.st_uid) ? "" :
+ ", and you do not own it");
printf("remove it? [ny](n): ");
fflush(stdout);
yn = getchar();