diff options
author | Xavier Santolaria <xsa@cvs.openbsd.org> | 2006-05-03 07:10:40 +0000 |
---|---|---|
committer | Xavier Santolaria <xsa@cvs.openbsd.org> | 2006-05-03 07:10:40 +0000 |
commit | 1ee1efcc1f59b70d41e53d158619f98e43ea0976 (patch) | |
tree | 964346217048662db2612152d10668fc7bca1e24 /usr.bin | |
parent | ae5998549bf956bccaebf5e2c0a499fffd5886c3 (diff) |
respect TMPDIR; OK ray@.
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/rcs/diff3.c | 28 |
1 files changed, 19 insertions, 9 deletions
diff --git a/usr.bin/rcs/diff3.c b/usr.bin/rcs/diff3.c index 8ec3e9d3130..1b43b8b8691 100644 --- a/usr.bin/rcs/diff3.c +++ b/usr.bin/rcs/diff3.c @@ -1,4 +1,4 @@ -/* $OpenBSD: diff3.c,v 1.3 2006/04/29 05:31:28 ray Exp $ */ +/* $OpenBSD: diff3.c,v 1.4 2006/05/03 07:10:39 xsa Exp $ */ /* * Copyright (C) Caldera International Inc. 2001-2002. @@ -72,14 +72,13 @@ static const char copyright[] = #ifndef lint static const char rcsid[] = - "$OpenBSD: diff3.c,v 1.3 2006/04/29 05:31:28 ray Exp $"; + "$OpenBSD: diff3.c,v 1.4 2006/05/03 07:10:39 xsa Exp $"; #endif /* not lint */ #include "includes.h" #include "diff.h" -#include "rcsutil.h" -#include "xmalloc.h" +#include "rcsprog.h" /* diff3 - 3-way differential file comparison */ @@ -186,9 +185,16 @@ rcs_diff3(RCSFILE *rf, char *workfile, RCSNUM *rev1, RCSNUM *rev2, int verbose) d2 = rcs_buf_alloc((size_t)128, BUF_AUTOEXT); diffb = rcs_buf_alloc((size_t)128, BUF_AUTOEXT); - if (strlcpy(path1, "/tmp/diff1.XXXXXXXXXX", sizeof(path1)) >= sizeof(path1) || - strlcpy(path2, "/tmp/diff2.XXXXXXXXXX", sizeof(path2)) >= sizeof(path2) || - strlcpy(path3, "/tmp/diff3.XXXXXXXXXX", sizeof(path3)) >= sizeof(path3)) + if (strlcpy(path1, rcs_tmpdir, sizeof(path1)) >= sizeof(path1) || + strlcat(path1, "/diff1.XXXXXXXXXX", sizeof(path1)) >= sizeof(path1)) + errx(1, "rcs_diff3: string truncated"); + + if (strlcpy(path2, rcs_tmpdir, sizeof(path2)) >= sizeof(path2) || + strlcat(path2, "/diff2.XXXXXXXXXX", sizeof(path2)) >= sizeof(path2)) + errx(1, "rcs_diff3: string truncated"); + + if (strlcpy(path3, rcs_tmpdir, sizeof(path3)) >= sizeof(path3) || + strlcat(path3, "/diff3.XXXXXXXXXX", sizeof(path3)) >= sizeof(path3)) errx(1, "rcs_diff3: string truncated"); rcs_buf_write_stmp(b1, path1, 0600); @@ -201,15 +207,19 @@ rcs_diff3(RCSFILE *rf, char *workfile, RCSNUM *rev1, RCSNUM *rev2, int verbose) rcs_diffreg(path1, path3, d1); rcs_diffreg(path2, path3, d2); - if (strlcpy(dp13, "/tmp/d13.XXXXXXXXXX", sizeof(dp13)) >= sizeof(dp13)) + if (strlcpy(dp13, rcs_tmpdir, sizeof(dp13)) >= sizeof(dp13) || + strlcat(dp13, "/d13.XXXXXXXXXX" , sizeof(dp13)) >= sizeof(dp13)) errx(1, "rcs_diff3: string truncated"); + rcs_buf_write_stmp(d1, dp13, 0600); rcs_buf_free(d1); d1 = NULL; - if (strlcpy(dp23, "/tmp/d23.XXXXXXXXXX", sizeof(dp23)) >= sizeof(dp23)) + if (strlcpy(dp23, rcs_tmpdir, sizeof(dp23)) >= sizeof(dp23) || + strlcat(dp23, "/d23.XXXXXXXXXX", sizeof(dp23)) >= sizeof(dp23)) errx(1, "rcs_diff3: string truncated"); + rcs_buf_write_stmp(d2, dp23, 0600); rcs_buf_free(d2); |