ladybird/Ports/openssh/patches/0006-Use-sendfd-recvfd-on-serenity.patch

46 lines
1.2 KiB
Diff

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
}