From 8e4a343572aa68e38a3936eb72fc7c81f7e52797 Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Sun, 31 Oct 2010 15:37:35 +0000 Subject: 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 --- usr.bin/cvs/rcs.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'usr.bin/cvs/rcs.c') 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 * 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, ...) { -- cgit v1.2.3