pdsh: fix musl patch

This commit is contained in:
Duncaen 2025-06-08 21:21:38 +02:00
parent 807cd77a0c
commit 8c3fc66e91
No known key found for this signature in database
GPG key ID: 335C1D17EC3D6E35

View file

@ -1,23 +1,10 @@
From 48c728dfefa3b9aff01f598ff9d3f909001b8e81 Mon Sep 17 00:00:00 2001
From: Mark Grondona <grondo@eris.llnl.gov>
Date: Thu, 10 Mar 2016 16:01:18 -0800
Subject: [PATCH] privsep: do nothing if !HAVE_RRESVPORT
Source: https://gitlab.alpinelinux.org/alpine/aports/-/blob/master/community/pdsh/without-rresvport.patch
Based on: https://github.com/chaos/pdsh/commit/48c728dfefa3b9aff01f598ff9d3f909001b8e81
With addition of 2 hunks at 302 and 332.
If we don't have rresvport() do not enable privsep during
privsep_init() (it probably isn't used anyway). Also be sure
to undefine usage of rresvport and rresvport_af since these
symbols won't be found at compile or runtime.
Fixes #74
---
src/pdsh/privsep.c | 23 ++++++++++++++++++++++-
1 file changed, 22 insertions(+), 1 deletion(-)
diff --git a/src/pdsh/privsep.c b/src/pdsh/privsep.c
index 7e4134f2..2297b175 100644
--- a/src/pdsh/privsep.c
+++ b/src/pdsh/privsep.c
@@ -123,6 +123,10 @@ static int send_rresvport (int pipefd, int fd, int lport)
--- pdsh-pdsh-2.35-origin/src/pdsh/privsep.c
+++ pdsh-pdsh-2.35/src/pdsh/privsep.c
@@ -124,6 +124,10 @@
cmsg = (struct cmsghdr *) &buf;
#endif
@ -28,7 +15,7 @@ index 7e4134f2..2297b175 100644
memset (&msg, 0, sizeof (msg));
@@ -162,6 +166,7 @@ static int send_rresvport (int pipefd, int fd, int lport)
@@ -163,6 +167,7 @@
return (0);
}
@ -36,7 +23,7 @@ index 7e4134f2..2297b175 100644
static int recv_rresvport (int pipefd, int *lptr)
{
int fd = -1;
@@ -203,19 +208,23 @@ static int recv_rresvport (int pipefd, int *lptr)
@@ -204,19 +209,23 @@
return (fd);
}
@ -61,7 +48,7 @@ index 7e4134f2..2297b175 100644
#endif
}
@@ -274,6 +283,9 @@ static int create_privileged_child (void)
@@ -275,6 +284,9 @@
int privsep_init (void)
{
@ -71,7 +58,7 @@ index 7e4134f2..2297b175 100644
if (geteuid() == getuid())
return 0;
@@ -285,6 +297,9 @@ int privsep_init (void)
@@ -286,6 +298,9 @@
int privsep_fini (void)
{
@ -81,7 +68,19 @@ index 7e4134f2..2297b175 100644
int status;
if (client_fd < 0 || cpid < 0)
return (0);
@@ -334,5 +349,11 @@ int privsep_rresvport_af (int *lport, int family)
@@ -303,6 +318,7 @@
return (0);
}
+#if HAVE_RRESVPORT
int privsep_rresvport_af (int *lport, int family)
{
int s = -1;
@@ -332,8 +348,15 @@
return (s);
}
+#endif
int privsep_rresvport (int *lport)
{