summaryrefslogtreecommitdiff
path: root/usr.bin/cvs/import.c
diff options
context:
space:
mode:
authorJoris Vink <joris@cvs.openbsd.org>2006-06-14 14:10:51 +0000
committerJoris Vink <joris@cvs.openbsd.org>2006-06-14 14:10:51 +0000
commit53c3e011c0e9b0a02a8c7ae04ba37fb4b2286574 (patch)
treef2297476a16d8c4c3f2b689b054e7d894174d98b /usr.bin/cvs/import.c
parenta160bec77bb30d38663d833116b460595af2b9c8 (diff)
add cvs_buf_load_fd() which does the same as cvs_buf_load()
except it takes a decriptor as argument instead of a path. modified cvs_buf_load() to open the descriptor then pass it to cvs_buf_load_fd(). change all the calls to cvs_buf_load() that have a descriptor open for the path to cvs_buf_load_fd() to prevent races.
Diffstat (limited to 'usr.bin/cvs/import.c')
-rw-r--r--usr.bin/cvs/import.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/usr.bin/cvs/import.c b/usr.bin/cvs/import.c
index c965fd235cd..c266a8eaf3f 100644
--- a/usr.bin/cvs/import.c
+++ b/usr.bin/cvs/import.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: import.c,v 1.49 2006/06/11 17:50:11 joris Exp $ */
+/* $OpenBSD: import.c,v 1.50 2006/06/14 14:10:50 joris Exp $ */
/*
* Copyright (c) 2006 Joris Vink <joris@openbsd.org>
*
@@ -179,7 +179,7 @@ import_new(struct cvs_file *cf)
if ((branch = rcsnum_parse(import_branch)) == NULL)
fatal("import_new: failed to parse branch");
- if ((bp = cvs_buf_load(cf->file_path, BUF_AUTOEXT)) == NULL)
+ if ((bp = cvs_buf_load_fd(cf->fd, BUF_AUTOEXT)) == NULL)
fatal("import_new: failed to load %s", cf->file_path);
cvs_buf_putc(bp, '\0');
@@ -249,8 +249,7 @@ import_update(struct cvs_file *cf)
if ((b1 = rcs_getrev(cf->file_rcs, rev)) == NULL)
fatal("import_update: failed to grab revision");
- /* XXX */
- if ((b2 = cvs_buf_load(cf->file_path, BUF_AUTOEXT)) == NULL)
+ if ((b2 = cvs_buf_load_fd(cf->fd, BUF_AUTOEXT)) == NULL)
fatal("import_update: failed to load %s",
cf->file_path);
@@ -321,8 +320,7 @@ import_get_rcsdiff(struct cvs_file *cf, RCSNUM *rev)
char *delta, *p1, *p2;
BUF *b1, *b2, *b3;
- /* XXX */
- if ((b1 = cvs_buf_load(cf->file_path, BUF_AUTOEXT)) == NULL)
+ if ((b1 = cvs_buf_load_fd(cf->fd, BUF_AUTOEXT)) == NULL)
fatal("import_get_rcsdiff: failed loading %s", cf->file_path);
if ((b2 = rcs_getrev(cf->file_rcs, rev)) == NULL)