diff options
author | Joris Vink <joris@cvs.openbsd.org> | 2006-03-30 23:19:21 +0000 |
---|---|---|
committer | Joris Vink <joris@cvs.openbsd.org> | 2006-03-30 23:19:21 +0000 |
commit | 875e8c358446b221ec26ef74163d817beac5e997 (patch) | |
tree | daa9dbc8deb6454425ce70d27a2e9a2d1776177d /usr.bin/rcs/rcsdiff.c | |
parent | c088de16bb60fa31238c0b019977e7fbf41fdd16 (diff) |
add temporary files to the worklist before creating them, this prevents
a race when the user would interrupt the program when it was returning
from cvs_buf_write_stmp() and leave the temporary files behind.
Diffstat (limited to 'usr.bin/rcs/rcsdiff.c')
-rw-r--r-- | usr.bin/rcs/rcsdiff.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/usr.bin/rcs/rcsdiff.c b/usr.bin/rcs/rcsdiff.c index 24bad19731b..c791d6b1059 100644 --- a/usr.bin/rcs/rcsdiff.c +++ b/usr.bin/rcs/rcsdiff.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rcsdiff.c,v 1.41 2006/03/24 05:14:48 ray Exp $ */ +/* $OpenBSD: rcsdiff.c,v 1.42 2006/03/30 23:19:20 joris Exp $ */ /* * Copyright (c) 2005 Joris Vink <joris@openbsd.org> * All rights reserved. @@ -209,9 +209,10 @@ rcsdiff_file(RCSFILE *file, RCSNUM *rev, const char *filename) strlcpy(path1, rcs_tmpdir, sizeof(path1)); strlcat(path1, "/diff1.XXXXXXXXXX", sizeof(path1)); - cvs_buf_write_stmp(b1, path1, 0600); cvs_worklist_add(path1, &rcs_temp_files); + cvs_buf_write_stmp(b1, path1, 0600); + cvs_buf_free(b1); b1 = NULL; @@ -220,9 +221,10 @@ rcsdiff_file(RCSFILE *file, RCSNUM *rev, const char *filename) strlcpy(path2, rcs_tmpdir, sizeof(path2)); strlcat(path2, "/diff2.XXXXXXXXXX", sizeof(path2)); - cvs_buf_write_stmp(b2, path2, 0600); cvs_worklist_add(path2, &rcs_temp_files); + cvs_buf_write_stmp(b2, path2, 0600); + cvs_buf_free(b2); b2 = NULL; @@ -288,9 +290,10 @@ rcsdiff_rev(RCSFILE *file, RCSNUM *rev1, RCSNUM *rev2) strlcpy(path1, rcs_tmpdir, sizeof(path1)); strlcat(path1, "/diff1.XXXXXXXXXX", sizeof(path1)); - cvs_buf_write_stmp(b1, path1, 0600); cvs_worklist_add(path1, &rcs_temp_files); + cvs_buf_write_stmp(b1, path1, 0600); + cvs_buf_free(b1); b1 = NULL; @@ -299,9 +302,10 @@ rcsdiff_rev(RCSFILE *file, RCSNUM *rev1, RCSNUM *rev2) strlcpy(path2, rcs_tmpdir, sizeof(path2)); strlcat(path2, "/diff2.XXXXXXXXXX", sizeof(path2)); - cvs_buf_write_stmp(b2, path2, 0600); cvs_worklist_add(path2, &rcs_temp_files); + cvs_buf_write_stmp(b2, path2, 0600); + cvs_buf_free(b2); b2 = NULL; |