From 27c1a76cf82a766a40719b0c0879787dbc35afbb Mon Sep 17 00:00:00 2001 From: psychon Date: Thu, 17 Jul 2008 10:30:32 +0000 Subject: [PATCH] Shell module: Don't give any stdin to executed apps We now close the write end of the pipe that serves as stdin for the apps we run. This means that any read attempts will return EOD (read() returns 0) which should hopefully tell our apps that we don't have stdin for them. Sadly vim doesn't care... (Only thing I tested that still broke) git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1136 726aef4b-f618-498e-8847-2d620e286838 --- modules/shell.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/modules/shell.cpp b/modules/shell.cpp index 02f4513b..1ba68977 100644 --- a/modules/shell.cpp +++ b/modules/shell.cpp @@ -18,6 +18,11 @@ public: EnableReadLine(); m_pParent = pShellMod; m_pClient = pClient; + + // Get rid of that write fd, we aren't going to use it + // (And clients expecting input will fail this way). + close(GetWSock()); + SetWSock(open("/dev/null", O_WRONLY)); } // These next two function's bodies are at the bottom of the file since they reference CShellMod virtual void ReadLine(const CString& sData);