summaryrefslogtreecommitdiff
path: root/Ports/openssh/patches/0006-Use-sendfd-recvfd-on-serenity.patch
blob: e90ab32c3f8e8fd1197335c6523b70672b769b5a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Gunnar Beutner <gbeutner@serenityos.org>
Date: Sat, 30 Apr 2022 10:58:10 +0000
Subject: [PATCH] Use sendfd/recvfd on serenity

Co-Authored-By: Patrick Meyer <git@the-space.agency>
---
 monitor_fdpass.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/monitor_fdpass.c b/monitor_fdpass.c
index a07727a..ad6774e 100644
--- a/monitor_fdpass.c
+++ b/monitor_fdpass.c
@@ -51,6 +51,7 @@
 int
 mm_send_fd(int sock, int fd)
 {
+#ifndef __serenity__
 #if defined(HAVE_SENDMSG) && (defined(HAVE_ACCRIGHTS_IN_MSGHDR) || defined(HAVE_CONTROL_IN_MSGHDR))
 	struct msghdr msg;
 #ifndef HAVE_ACCRIGHTS_IN_MSGHDR
@@ -106,11 +107,15 @@ mm_send_fd(int sock, int fd)
 	error("%s: file descriptor passing not supported", __func__);
 	return -1;
 #endif
+#else
+    return sendfd(sock, fd);
+#endif
 }
 
 int
 mm_receive_fd(int sock)
 {
+#ifndef __serenity__
 #if defined(HAVE_RECVMSG) && (defined(HAVE_ACCRIGHTS_IN_MSGHDR) || defined(HAVE_CONTROL_IN_MSGHDR))
 	struct msghdr msg;
 #ifndef HAVE_ACCRIGHTS_IN_MSGHDR
@@ -182,4 +187,7 @@ mm_receive_fd(int sock)
 	error_f("file descriptor passing not supported");
 	return -1;
 #endif
+#else
+    return recvfd(sock, 0);
+#endif
 }