=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/rcs/diff3.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- src/usr.bin/rcs/diff3.c 2006/04/29 05:31:28 1.3 +++ src/usr.bin/rcs/diff3.c 2006/05/03 07:10:39 1.4 @@ -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 @@ #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,11 +185,18 @@ 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); rcs_buf_write_stmp(b2, path2, 0600); rcs_buf_write_stmp(b3, path3, 0600); @@ -201,15 +207,19 @@ 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);