summaryrefslogtreecommitdiff
path: root/usr.bin/rcs/ci.c
diff options
context:
space:
mode:
authorXavier Santolaria <xsa@cvs.openbsd.org>2006-05-04 07:06:59 +0000
committerXavier Santolaria <xsa@cvs.openbsd.org>2006-05-04 07:06:59 +0000
commit9129cc7937745e4dec0b5200313873e29cf670fd (patch)
treef4dc7fcbddf3b10c59f681c1ef5a0d7cda5e5558 /usr.bin/rcs/ci.c
parent190a37dc66c307be2b9693909422e288bf2f563e (diff)
finish work wrt TMPDIR; use xasprintf() to simplify code while in there;
"looks fine" ray@.
Diffstat (limited to 'usr.bin/rcs/ci.c')
-rw-r--r--usr.bin/rcs/ci.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/usr.bin/rcs/ci.c b/usr.bin/rcs/ci.c
index 4a4d06e7aab..cbadf6db726 100644
--- a/usr.bin/rcs/ci.c
+++ b/usr.bin/rcs/ci.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ci.c,v 1.167 2006/04/29 06:32:00 ray Exp $ */
+/* $OpenBSD: ci.c,v 1.168 2006/05/04 07:06:58 xsa Exp $ */
/*
* Copyright (c) 2005, 2006 Niall O'Higgins <niallo@openbsd.org>
* All rights reserved.
@@ -329,7 +329,7 @@ checkin_main(int argc, char **argv)
static char *
checkin_diff_file(struct checkin_params *pb)
{
- char path1[MAXPATHLEN], path2[MAXPATHLEN];
+ char *path1, *path2;
BUF *b1, *b2, *b3;
char rbuf[64], *deltatext;
@@ -352,17 +352,13 @@ checkin_diff_file(struct checkin_params *pb)
goto out;
}
- if (strlcpy(path1, rcs_tmpdir, sizeof(path1)) >= sizeof(path1) ||
- strlcat(path1, "/diff1.XXXXXXXXXX", sizeof(path1)) >= sizeof(path1))
- errx(1, "path truncated");
+ (void)xasprintf(&path1, "%s/diff1.XXXXXXXXXX", rcs_tmpdir);
rcs_buf_write_stmp(b1, path1, 0600);
rcs_buf_free(b1);
b1 = NULL;
- if (strlcpy(path2, rcs_tmpdir, sizeof(path2)) >= sizeof(path2) ||
- strlcat(path2, "/diff2.XXXXXXXXXX", sizeof(path2)) >= sizeof(path2))
- errx(1, "path truncated");
+ (void)xasprintf(&path2, "%s/diff2.XXXXXXXXXX", rcs_tmpdir);
rcs_buf_write_stmp(b2, path2, 0600);
rcs_buf_free(b2);
@@ -382,6 +378,10 @@ out:
rcs_buf_free(b2);
if (b3 != NULL)
rcs_buf_free(b3);
+ if (path1 != NULL)
+ xfree(path1);
+ if (path2 != NULL)
+ xfree(path2);
return (deltatext);
}