From 56baaaffa89c8d78e132043a3b5edfcbaa28bbc9 Mon Sep 17 00:00:00 2001 From: Sebastien Helleu Date: Sat, 20 Jul 2013 15:45:25 +0200 Subject: core: use "/dev/null" for stdin in hook_process instead of closing stdin (bug #39538) --- ChangeLog | 2 ++ src/core/wee-hook.c | 7 ++----- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index e4e9d1f05..cb3c227fb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -14,6 +14,8 @@ http://weechat.org/files/releasenotes/ReleaseNotes-devel.html[release notes] Version 0.4.2 (under dev!) -------------------------- +* core: use "/dev/null" for stdin in hook_process instead of closing stdin + (bug #39538) * core: add option "scroll_beyond_end" for command /window (task #6745) * core: add options weechat.look.hotlist_prefix and weechat.look.hotlist_suffix (task #12730) diff --git a/src/core/wee-hook.c b/src/core/wee-hook.c index 6390dc3d1..cdc24d018 100644 --- a/src/core/wee-hook.c +++ b/src/core/wee-hook.c @@ -1435,11 +1435,8 @@ hook_process_child (struct t_hook *hook_process) const char *ptr_url, *ptr_arg; int rc, i, num_args; - /* - * close stdin, so that process will fail to read stdin (process reading - * stdin should not be run inside WeeChat!) - */ - close (STDIN_FILENO); + /* use "/dev/null" for stdin stream */ + freopen ("/dev/null", "r", stdin); /* redirect stdout/stderr to pipe (so that father process can read them) */ close (HOOK_PROCESS(hook_process, child_read[HOOK_PROCESS_STDOUT])); -- cgit v1.2.3