mh_execm: get rid of child process in case of error, for a clean start on next request (handle rclzip crash on encrypted files)
This commit is contained in:
parent
74fa554067
commit
e8671c83be
@ -172,6 +172,7 @@ bool MimeHandlerExecMultiple::next_document()
|
|||||||
obuf << "Mimetype: " << m_mimeType.length() << "\n" << m_mimeType;
|
obuf << "Mimetype: " << m_mimeType.length() << "\n" << m_mimeType;
|
||||||
obuf << "\n";
|
obuf << "\n";
|
||||||
if (m_cmd.send(obuf.str()) < 0) {
|
if (m_cmd.send(obuf.str()) < 0) {
|
||||||
|
m_cmd.zapChild();
|
||||||
LOGERR(("MHExecMultiple: send error\n"));
|
LOGERR(("MHExecMultiple: send error\n"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -185,6 +186,7 @@ bool MimeHandlerExecMultiple::next_document()
|
|||||||
for (int loop=0;;loop++) {
|
for (int loop=0;;loop++) {
|
||||||
string name, data;
|
string name, data;
|
||||||
if (!readDataElement(name, data)) {
|
if (!readDataElement(name, data)) {
|
||||||
|
m_cmd.zapChild();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (name.empty())
|
if (name.empty())
|
||||||
|
|||||||
@ -462,9 +462,9 @@ int ExecCmd::wait(bool haderror)
|
|||||||
if (!m_killRequest && m_pid > 0) {
|
if (!m_killRequest && m_pid > 0) {
|
||||||
if (waitpid(m_pid, &status, 0) < 0)
|
if (waitpid(m_pid, &status, 0) < 0)
|
||||||
status = -1;
|
status = -1;
|
||||||
|
LOGDEB(("ExecCmd::wait: got status 0x%x\n", status));
|
||||||
m_pid = -1;
|
m_pid = -1;
|
||||||
}
|
}
|
||||||
LOGDEB(("ExecCmd::wait: got status 0x%x\n", status));
|
|
||||||
return haderror ? -1 : status;
|
return haderror ? -1 : status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -147,6 +147,11 @@ class ExecCmd {
|
|||||||
*/
|
*/
|
||||||
void setKill() {m_killRequest = true;}
|
void setKill() {m_killRequest = true;}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get rid of current process (become ready for start).
|
||||||
|
*/
|
||||||
|
void zapChild() {setKill(); (void)wait();}
|
||||||
|
|
||||||
ExecCmd()
|
ExecCmd()
|
||||||
: m_advise(0), m_provide(0), m_timeoutMs(1000)
|
: m_advise(0), m_provide(0), m_timeoutMs(1000)
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user