Make the shell module generate error messages if fork() or pipe() fail

git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1369 726aef4b-f618-498e-8847-2d620e286838
This commit is contained in:
psychon
2009-02-03 19:42:40 +00:00
parent 607bb4e1ce
commit c7a98e7ec8
2 changed files with 11 additions and 6 deletions

View File

@@ -14,11 +14,18 @@ class CShellMod;
class CShellSock : public CExecSock {
public:
CShellSock(CShellMod* pShellMod, CClient* pClient, const CString& sExec) : CExecSock(sExec) {
CShellSock(CShellMod* pShellMod, CClient* pClient, const CString& sExec) : CExecSock() {
EnableReadLine();
m_pParent = pShellMod;
m_pClient = pClient;
if (Execute(sExec) == -1) {
CString s = "Failed to execute: ";
s += strerror(errno);
ReadLine(s);
return;
}
// Get rid of that write fd, we aren't going to use it
// (And clients expecting input will fail this way).
close(GetWSock());