"GOT", but the "O" is a cute, smiling pufferfish. Index | Thread | Search

From:
Josiah Frentsos <jfrent@tilde.team>
Subject:
Consistently use ten Xs in mkstemp(3) templates
To:
gameoftrees@openbsd.org
Date:
Sun, 28 May 2023 22:35:25 -0400

Download raw body.

Thread
diff b0e037dbf2ecde75e22f3a4a7b63e8a11f9a6a63 19f82b4fea58f1239ba82de7dfd73fb34b38e387
commit - b0e037dbf2ecde75e22f3a4a7b63e8a11f9a6a63
commit + 19f82b4fea58f1239ba82de7dfd73fb34b38e387
blob - 5cd79150cc6476f78c90b997d76b00eaa99fc341
blob + c1ca2fdf44d461cda6adb950263ed6a9775971ac
--- lib/diff3.c
+++ lib/diff3.c
@@ -310,15 +310,15 @@ got_merge_diff3(int *overlapcnt, int outfd, FILE *f1, 
 	if (err)
 		goto out;
 
-	if (asprintf(&path1, GOT_TMPDIR_STR "/got-diff1.XXXXXXXX") == -1) {
+	if (asprintf(&path1, GOT_TMPDIR_STR "/got-diff1.XXXXXXXXXX") == -1) {
 		err = got_error_from_errno("asprintf");
 		goto out;
 	}
-	if (asprintf(&path2, GOT_TMPDIR_STR "/got-diff2.XXXXXXXX") == -1) {
+	if (asprintf(&path2, GOT_TMPDIR_STR "/got-diff2.XXXXXXXXXX") == -1) {
 		err = got_error_from_errno("asprintf");
 		goto out;
 	}
-	if (asprintf(&path3, GOT_TMPDIR_STR "/got-diff3.XXXXXXXX") == -1) {
+	if (asprintf(&path3, GOT_TMPDIR_STR "/got-diff3.XXXXXXXXXX") == -1) {
 		err = got_error_from_errno("asprintf");
 		goto out;
 	}
blob - 0e4865ca9ef8a0f80cc03e76722c8280c20510bf
blob + 67ac8fd64b02a0f981bf9c39b34dbd03485649a2
--- lib/opentemp.c
+++ lib/opentemp.c
@@ -29,7 +29,7 @@ got_opentempfd(void)
 	char name[PATH_MAX];
 	int fd;
 
-	if (strlcpy(name, GOT_TMPDIR_STR "/got.XXXXXXXX", sizeof(name))
+	if (strlcpy(name, GOT_TMPDIR_STR "/got.XXXXXXXXXX", sizeof(name))
 	    >= sizeof(name))
 		return -1;
 
@@ -71,7 +71,7 @@ got_opentemp_named(char **path, FILE **outfile, const 
 
 	*outfile = NULL;
 
-	if (asprintf(path, "%s-XXXXXX%s", basepath, suffix) == -1) {
+	if (asprintf(path, "%s-XXXXXXXXXX%s", basepath, suffix) == -1) {
 		*path = NULL;
 		return got_error_from_errno("asprintf");
 	}
@@ -103,7 +103,7 @@ got_opentemp_named_fd(char **path, int *outfd, const c
 
 	*outfd = -1;
 
-	if (asprintf(path, "%s-XXXXXX%s", basepath, suffix) == -1) {
+	if (asprintf(path, "%s-XXXXXXXXXX%s", basepath, suffix) == -1) {
 		*path = NULL;
 		return got_error_from_errno("asprintf");
 	}
blob - 12bca5996322c1822c24ced40493cd7acb0ca896
blob + f8c6bfd3e10294f056b420f98add07f8c8d0dd33
--- regress/cmdline/common.sh
+++ regress/cmdline/common.sh
@@ -217,7 +217,8 @@ test_init()
 		echo "No test name provided" >&2
 		return 1
 	fi
-	local testroot=`mktemp -d "$GOT_TEST_ROOT/got-test-$testname-XXXXXXXX"`
+	local testroot=`mktemp -d \
+	    "$GOT_TEST_ROOT/got-test-$testname-XXXXXXXXXX"`
 	mkdir $testroot/repo
 	git_init $testroot/repo
 	if [ -z "$no_tree" ]; then
blob - c2f3ee46fef581bf98a2713c1d619163cb51f339
blob + 614c0254175714f853d026e00d9c0330ef34b33a
--- regress/cmdline/import.sh
+++ regress/cmdline/import.sh
@@ -18,7 +18,8 @@ test_import_basic() {
 
 test_import_basic() {
 	local testname=import_basic
-	local testroot=`mktemp -d "$GOT_TEST_ROOT/got-test-$testname-XXXXXXXX"`
+	local testroot=`mktemp -d \
+	    "$GOT_TEST_ROOT/got-test-$testname-XXXXXXXXXX"`
 
 	gotadmin init $testroot/repo
 
@@ -142,7 +143,8 @@ test_import_specified_head() {
 
 test_import_specified_head() {
 	local testname=import_specified_head
-	local testroot=`mktemp -d "$GOT_TEST_ROOT/got-test-$testname-XXXXXXXX"`
+	local testroot=`mktemp -d \
+	    "$GOT_TEST_ROOT/got-test-$testname-XXXXXXXXXX"`
 	local headref=trunk
 
 	gotadmin init -b $headref $testroot/repo
@@ -367,7 +369,8 @@ test_import_ignores() {
 
 test_import_ignores() {
 	local testname=import_ignores
-	local testroot=`mktemp -d "$GOT_TEST_ROOT/got-test-$testname-XXXXXXXX"`
+	local testroot=`mktemp -d \
+	    "$GOT_TEST_ROOT/got-test-$testname-XXXXXXXXXX"`
 
 	gotadmin init $testroot/repo
 
@@ -400,7 +403,8 @@ test_import_empty_dir() {
 
 test_import_empty_dir() {
 	local testname=import_empty_dir
-	local testroot=`mktemp -d "$GOT_TEST_ROOT/got-test-$testname-XXXXXXXX"`
+	local testroot=`mktemp -d \
+	    "$GOT_TEST_ROOT/got-test-$testname-XXXXXXXXXX"`
 
 	gotadmin init $testroot/repo
 
@@ -443,7 +447,8 @@ test_import_symlink() {
 
 test_import_symlink() {
 	local testname=import_symlink
-	local testroot=`mktemp -d "$GOT_TEST_ROOT/got-test-$testname-XXXXXXXX"`
+	local testroot=`mktemp -d \
+	    "$GOT_TEST_ROOT/got-test-$testname-XXXXXXXXXX"`
 
 	gotadmin init $testroot/repo
 
blob - c0aa7e8388bf26432184a39d3c0257a016975b76
blob + 22184fffc887851e4b8c369a306088ffc4bf4686
--- regress/cmdline/init.sh
+++ regress/cmdline/init.sh
@@ -18,7 +18,8 @@ test_init_basic() {
 
 test_init_basic() {
 	local testname=init_basic
-	local testroot=`mktemp -d "$GOT_TEST_ROOT/got-test-$testname-XXXXXXXX"`
+	local testroot=`mktemp -d \
+	    "$GOT_TEST_ROOT/got-test-$testname-XXXXXXXXXX"`
 	local headref=main
 
 	gotadmin init $testroot/repo
@@ -37,7 +38,8 @@ test_init_specified_head() {
 
 test_init_specified_head() {
 	local testname=init_specified_head
-	local testroot=`mktemp -d "$GOT_TEST_ROOT/got-test-$testname-XXXXXXXX"`
+	local testroot=`mktemp -d \
+	    "$GOT_TEST_ROOT/got-test-$testname-XXXXXXXXXX"`
 	local headref=trunk
 
 	gotadmin init -b $headref $testroot/repo
blob - 4fef3e998b0e8055a0acac216cc71828bdcea5c5
blob + ddfc0f1e9d1f0c373066bc33b387387e5beeaf0d
--- regress/gotd/Makefile
+++ regress/gotd/Makefile
@@ -13,7 +13,7 @@ GOTD_TEST_REPO!?=mktemp -d "$(GOTD_TEST_ROOT)/gotd-tes
 GOTD_TEST_ROOT=/tmp
 GOTD_DEVUSER?=gotdev
 GOTD_DEVUSER_HOME!=userinfo $(GOTD_DEVUSER) | awk '/^dir/ {print $$2}'
-GOTD_TEST_REPO!?=mktemp -d "$(GOTD_TEST_ROOT)/gotd-test-repo-XXXXXXXXX"
+GOTD_TEST_REPO!?=mktemp -d "$(GOTD_TEST_ROOT)/gotd-test-repo-XXXXXXXXXX"
 GOTD_TEST_REPO_URL=ssh://${GOTD_DEVUSER}@127.0.0.1/test-repo
 
 GOTD_TEST_USER?=${DOAS_USER}
blob - 016110f9a8369c7d2288fbc68fa858b04c36f2c4
blob + 3fe3744d90fb5f9a963339227ba308d8236361be
--- regress/gotd/common.sh
+++ regress/gotd/common.sh
@@ -22,7 +22,8 @@ test_init()
 		echo "No test name provided" >&2
 		return 1
 	fi
-	local testroot=`mktemp -d "$GOTD_TEST_ROOT/gotd-test-$testname-XXXXXXXX"`
+	local testroot=`mktemp -d \
+	    "$GOTD_TEST_ROOT/gotd-test-$testname-XXXXXXXXXX"`
 	mkdir $testroot/repo
 	git_init $testroot/repo
 	if [ -z "$no_tree" ]; then
blob - 24bceaedbd0b5f96864aeb98fb8f75684810689b
blob + 8e364cdc52ed8662ae2562398c885d5a21c3061b
--- regress/gotd/prepare_test_repo.sh
+++ regress/gotd/prepare_test_repo.sh
@@ -27,7 +27,7 @@ make_repo()
 		return
 	fi
 
-	test_tree=`mktemp -d "${GOTD_TEST_ROOT}/gotd-test-tree-XXXXXXXXX"`
+	test_tree=`mktemp -d "${GOTD_TEST_ROOT}/gotd-test-tree-XXXXXXXXXX"`
 	make_test_tree "$test_tree"
 	got import -m "import the test tree" -r "${GOTD_TEST_REPO}" "$test_tree" \
 		> /dev/null
blob - 5c67c9b6991543475718b5f280e03afe3d39a724
blob + 6c2f1b6d029a9d9aaf7a02a830665aea07a8b934
--- regress/tog/common.sh
+++ regress/tog/common.sh
@@ -89,7 +89,7 @@ test_init()
 		return 1
 	fi
 
-	testroot=`mktemp -d "$GOT_TEST_ROOT/tog-test-$testname-XXXXXXXX"`
+	testroot=`mktemp -d "$GOT_TEST_ROOT/tog-test-$testname-XXXXXXXXXX"`
 
 	set_test_env $testroot/$testname $testroot/view $columns $lines