summaryrefslogtreecommitdiff
path: root/usr.bin/cvs/rcs.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2010-10-31 15:37:35 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2010-10-31 15:37:35 +0000
commit8e4a343572aa68e38a3936eb72fc7c81f7e52797 (patch)
tree62e01f4d220ea1a10c080d590793b0a3b688d55f /usr.bin/cvs/rcs.c
parent45451c0cba4d5bcad865bc91daabf8783a94a81d (diff)
init was passing a writable file descriptor into rcs_open which was then
failing to fdopen() it as readable. It doesn't need to pass in the fd at all, so just change it to pass -1 which makes cvs init work again. In fact, the fd should never need to be writable - it is only used for reading. RCS_WRITE triggers a rewrite on the file on rcs_close() but this is done by using a temporary and rename(2) (RCS_WRITE is a poor name for the flag). So while here, add a couple of comments to hopefully make it a little clearer. There is some confusion about how this is used in other places but checking those is a separate issue. with and ok tobias
Diffstat (limited to 'usr.bin/cvs/rcs.c')
-rw-r--r--usr.bin/cvs/rcs.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/usr.bin/cvs/rcs.c b/usr.bin/cvs/rcs.c
index 84adf7d7be3..fa8ff39cdd0 100644
--- a/usr.bin/cvs/rcs.c
+++ b/usr.bin/cvs/rcs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rcs.c,v 1.306 2010/10/27 08:35:45 tobias Exp $ */
+/* $OpenBSD: rcs.c,v 1.307 2010/10/31 15:37:34 nicm Exp $ */
/*
* Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org>
* All rights reserved.
@@ -144,6 +144,10 @@ static void rcs_strprint(const u_char *, size_t, FILE *);
static void rcs_kwexp_line(char *, struct rcs_delta *, struct rcs_lines *,
struct rcs_line *, int mode);
+/*
+ * Prepare RCSFILE for parsing. The given file descriptor (if any) must be
+ * read-only and is closed on rcs_close().
+ */
RCSFILE *
rcs_open(const char *path, int fd, int flags, ...)
{