From df3a4e509cd581d1f7a20e485d02335219e83daf Mon Sep 17 00:00:00 2001 From: Joris Vink Date: Wed, 26 Apr 2006 21:55:23 +0000 Subject: prevent file races by obtaining an fd for the RCS file and do our operations on that, this is safe and guarantees we can operate on the file until we close(2) it. a fix is coming for the remaining races in our diff code. okay niallo@ and ray@ --- usr.bin/rcs/rcs.h | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'usr.bin/rcs/rcs.h') diff --git a/usr.bin/rcs/rcs.h b/usr.bin/rcs/rcs.h index 4ae27d19e0b..adf7677bdc6 100644 --- a/usr.bin/rcs/rcs.h +++ b/usr.bin/rcs/rcs.h @@ -1,4 +1,4 @@ -/* $OpenBSD: rcs.h,v 1.1 2006/04/26 02:55:13 joris Exp $ */ +/* $OpenBSD: rcs.h,v 1.2 2006/04/26 21:55:22 joris Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau * All rights reserved. @@ -190,6 +190,7 @@ struct rcs_delta { typedef struct rcs_file { + int fd; char *rf_path; mode_t rf_mode; u_int rf_flags; @@ -209,11 +210,9 @@ typedef struct rcs_file { void *rf_pdata; } RCSFILE; - extern int rcs_errno; - -RCSFILE *rcs_open(const char *, int, ...); +RCSFILE *rcs_open(const char *, int, int, ...); void rcs_close(RCSFILE *); const RCSNUM *rcs_head_get(RCSFILE *); int rcs_head_set(RCSFILE *, RCSNUM *); @@ -253,7 +252,6 @@ RCSNUM *rcs_tag_resolve(RCSFILE *, const char *); const char *rcs_errstr(int); int rcs_write(RCSFILE *); - int rcs_kflag_get(const char *); void rcs_kflag_usage(void); int rcs_kw_expand(RCSFILE *, u_char *, size_t, size_t *); @@ -272,9 +270,7 @@ int rcsnum_cmp(const RCSNUM *, const RCSNUM *, u_int); /* rcstime.c */ void rcs_set_tz(char *, struct rcs_delta *, struct tm *); - extern char *timezone_flag; - extern int rcsnum_flags; #endif /* RCS_H */ -- cgit v1.2.3