Commit c632297d7b6d7267543afeb7b052dc8a970cdefe

Josh Rickmar 2022-07-03T21:49:23

Use pipe() which is a more understood syscall than pipe2() which doesn't exist on MacOS, for instance. Since we we're passing in 0 to pipe2(), this mean no fcntl() flags were being sent. As such, it's the same syscall as pipe() which also has the added benefit that it's more portable. committing on behalf of thomas with my ok

diff --git a/lib/sigs.c b/lib/sigs.c
index 0b04e3f..bbdfb38 100644
--- a/lib/sigs.c
+++ b/lib/sigs.c
@@ -99,10 +99,10 @@ got_sigs_sign_tag_ssh(pid_t *newpid, int *in_fd, int *out_fd,
 	argv[i++] = NULL;
 	assert(i <= nitems(argv));
 
-	if (pipe2(in_pfd, 0) == -1)
-		return got_error_from_errno("pipe2");
-	if (pipe2(out_pfd, 0) == -1)
-		return got_error_from_errno("pipe2");
+	if (pipe(in_pfd) == -1)
+		return got_error_from_errno("pipe");
+	if (pipe(out_pfd) == -1)
+		return got_error_from_errno("pipe");
 
 	pid = fork();
 	if (pid == -1) {
@@ -321,12 +321,12 @@ got_sigs_verify_tag_ssh(char **msg, struct got_tag_object *tag,
 	argv[i++] = NULL;
 	assert(i <= nitems(argv));
 
-	if (pipe2(in_pfd, 0) == -1) {
-		error = got_error_from_errno("pipe2");
+	if (pipe(in_pfd) == -1) {
+		error = got_error_from_errno("pipe");
 		goto done;
 	}
-	if (pipe2(out_pfd, 0) == -1) {
-		error = got_error_from_errno("pipe2");
+	if (pipe(out_pfd) == -1) {
+		error = got_error_from_errno("pipe");
 		goto done;
 	}