summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastien Helleu <flashcode@flashtux.org>2013-07-20 15:45:25 +0200
committerSebastien Helleu <flashcode@flashtux.org>2013-07-20 15:45:25 +0200
commit56baaaffa89c8d78e132043a3b5edfcbaa28bbc9 (patch)
tree50a9198e5f090f86cd8314d613146ef54368a514
parentf4a030731658e4d5effe109cf175f0ff949fbfbb (diff)
downloadweechat-56baaaffa89c8d78e132043a3b5edfcbaa28bbc9.zip
core: use "/dev/null" for stdin in hook_process instead of closing stdin (bug #39538)
-rw-r--r--ChangeLog2
-rw-r--r--src/core/wee-hook.c7
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]));