Commit Diff


commit - d2533287ff253bfb6fe08ddc0005ac3349fdf38c
commit + 9cda65e55e3f6d565e83377712e1b81177639cda
blob - ef5a8b59c5e55dfdeec6f464375604437cc707d8
blob + 49dd805c03a534e38d4a01d90a18f868676a58b6
--- got/got.c
+++ got/got.c
@@ -7862,15 +7862,12 @@ patch_from_stdin(int *patchfd)
 {
 	const struct got_error *err = NULL;
 	ssize_t r;
-	char *path, buf[BUFSIZ];
+	char buf[BUFSIZ];
 	sig_t sighup, sigint, sigquit;
 
-	err = got_opentemp_named_fd(&path, patchfd,
-	    GOT_TMPDIR_STR "/got-patch");
-	if (err)
-		return err;
-	unlink(path);
-	free(path);
+	*patchfd = got_opentempfd();
+	if (*patchfd == -1)
+		return got_error_from_errno("got_opentempfd");
 
 	sighup = signal(SIGHUP, SIG_DFL);
 	sigint = signal(SIGINT, SIG_DFL);
blob - 1bcdb584a653439ff381dc63d0dc88145ee8fa36
blob + f8f949b792887413b26e30cab123e9e1c57ae123
--- regress/cmdline/patch.sh
+++ regress/cmdline/patch.sh
@@ -87,7 +87,7 @@ test_patch_basic() {
 +103
 EOF
 
-	(cd $testroot/wt && got patch patch) > $testroot/stdout
+	(cd $testroot/wt && got patch < patch) > $testroot/stdout
 	if [ $ret -ne 0 ]; then
 		test_done "$testroot" $ret
 		return 1