[pacman-dev] [PATCH] close stdin before running install scripts

Andrew Gregory andrew.gregory.8 at gmail.com
Wed Mar 25 09:54:26 UTC 2015


libalpm does not guarantee that script output will be presented to the
user or that stdin will be connected to a terminal.  Close stdin so that
scripts do not attempt to use it for user interaction.

Signed-off-by: Andrew Gregory <andrew.gregory.8 at gmail.com>
---

https://bbs.archlinux.org/viewtopic.php?id=194200

 lib/libalpm/util.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lib/libalpm/util.c b/lib/libalpm/util.c
index 4d85132..26d091b 100644
--- a/lib/libalpm/util.c
+++ b/lib/libalpm/util.c
@@ -536,6 +536,7 @@ int _alpm_run_chroot(alpm_handle_t *handle, const char *cmd, char *const argv[])
 
 	if(pid == 0) {
 		/* this code runs for the child only (the actual chroot/exec) */
+		close(0);
 		close(1);
 		close(2);
 		while(dup2(pipefd[1], 1) == -1 && errno == EINTR);
-- 
2.3.4


More information about the pacman-dev mailing list