PKGBUILDs/core/pacman/0003-Revert-alpm_run_chroot-always-connect-parent2child-p.patch

61 lines
2.2 KiB
Diff
Raw Normal View History

2024-03-16 00:14:20 +00:00
From e237b55a291cdcc5d52e55b896fc437f8ed922c8 Mon Sep 17 00:00:00 2001
2016-03-12 03:16:56 +00:00
From: Kevin Mihelich <kevin@archlinuxarm.org>
Date: Fri, 11 Mar 2016 20:11:24 -0700
2019-10-23 12:52:21 +00:00
Subject: [PATCH 3/3] Revert "alpm_run_chroot: always connect parent2child
2016-03-12 03:16:56 +00:00
pipe"
This reverts commit 1d6583a58da0904fb7feafd4a666391087955a7b.
---
lib/libalpm/util.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/lib/libalpm/util.c b/lib/libalpm/util.c
2024-03-16 00:14:20 +00:00
index 579d5093..02145ba7 100644
2016-03-12 03:16:56 +00:00
--- a/lib/libalpm/util.c
+++ b/lib/libalpm/util.c
2024-03-16 00:14:20 +00:00
@@ -624,7 +624,7 @@ int _alpm_run_chroot(alpm_handle_t *handle, const char *cmd, char *const argv[],
2016-03-12 03:16:56 +00:00
goto cleanup;
}
2018-05-29 00:53:59 +00:00
- if(socketpair(AF_UNIX, SOCK_STREAM, 0, parent2child_pipefd) == -1) {
+ if(stdin_cb && socketpair(AF_UNIX, SOCK_STREAM, 0, parent2child_pipefd) == -1) {
2016-03-12 03:16:56 +00:00
_alpm_log(handle, ALPM_LOG_ERROR, _("could not create pipe (%s)\n"), strerror(errno));
retval = 1;
goto cleanup;
2024-03-16 00:14:20 +00:00
@@ -644,9 +644,11 @@ int _alpm_run_chroot(alpm_handle_t *handle, const char *cmd, char *const argv[],
2016-03-12 03:16:56 +00:00
close(2);
2018-05-29 00:53:59 +00:00
while(dup2(child2parent_pipefd[HEAD], 1) == -1 && errno == EINTR);
while(dup2(child2parent_pipefd[HEAD], 2) == -1 && errno == EINTR);
- while(dup2(parent2child_pipefd[TAIL], 0) == -1 && errno == EINTR);
- close(parent2child_pipefd[TAIL]);
- close(parent2child_pipefd[HEAD]);
2016-03-12 03:16:56 +00:00
+ if(stdin_cb) {
2018-05-29 00:53:59 +00:00
+ while(dup2(parent2child_pipefd[TAIL], 0) == -1 && errno == EINTR);
+ close(parent2child_pipefd[TAIL]);
+ close(parent2child_pipefd[HEAD]);
2016-03-12 03:16:56 +00:00
+ }
2018-05-29 00:53:59 +00:00
close(child2parent_pipefd[TAIL]);
close(child2parent_pipefd[HEAD]);
2016-03-12 03:16:56 +00:00
if(cwdfd >= 0) {
2024-03-16 00:14:20 +00:00
@@ -693,16 +695,15 @@ int _alpm_run_chroot(alpm_handle_t *handle, const char *cmd, char *const argv[],
2016-03-12 03:16:56 +00:00
child2parent->events = POLLIN;
fcntl(child2parent->fd, F_SETFL, O_NONBLOCK);
2018-05-29 00:53:59 +00:00
close(child2parent_pipefd[HEAD]);
- close(parent2child_pipefd[TAIL]);
2016-03-12 03:16:56 +00:00
if(stdin_cb) {
2018-05-29 00:53:59 +00:00
parent2child->fd = parent2child_pipefd[HEAD];
2016-03-12 03:16:56 +00:00
parent2child->events = POLLOUT;
fcntl(parent2child->fd, F_SETFL, O_NONBLOCK);
2018-05-29 00:53:59 +00:00
+ close(parent2child_pipefd[TAIL]);
2016-03-12 03:16:56 +00:00
} else {
parent2child->fd = -1;
parent2child->events = 0;
2018-05-29 00:53:59 +00:00
- close(parent2child_pipefd[HEAD]);
2016-03-12 03:16:56 +00:00
}
#define STOP_POLLING(p) do { close(p->fd); p->fd = -1; } while(0)
--
2024-03-16 00:14:20 +00:00
2.36.1
2016-03-12 03:16:56 +00:00