mirror of https://github.com/Icinga/icinga2.git
Process: repeat read() until we get EAGAIN.
This commit is contained in:
parent
a80872b314
commit
b0d8c40d20
|
@ -380,19 +380,27 @@ bool Process::RunTask(void)
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
#ifndef _MSC_VER
|
#ifndef _MSC_VER
|
||||||
rc = read(m_FD, buffer, sizeof(buffer));
|
do {
|
||||||
|
rc = read(m_FD, buffer, sizeof(buffer));
|
||||||
#else /* _MSC_VER */
|
#else /* _MSC_VER */
|
||||||
if (!feof(m_FP))
|
if (!feof(m_FP))
|
||||||
rc = fread(buffer, 1, sizeof(buffer), m_FP);
|
rc = fread(buffer, 1, sizeof(buffer), m_FP);
|
||||||
else
|
else
|
||||||
rc = 0;
|
rc = 0;
|
||||||
#endif /* _MSC_VER */
|
#endif /* _MSC_VER */
|
||||||
|
|
||||||
if (rc > 0) {
|
if (rc > 0) {
|
||||||
m_OutputStream.write(buffer, rc);
|
m_OutputStream.write(buffer, rc);
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
return true;
|
||||||
|
#endif /* _MSC_VER */
|
||||||
|
}
|
||||||
|
#ifndef _MSC_VER
|
||||||
|
} while (rc > 0);
|
||||||
|
|
||||||
|
if (rc < 0 && errno == EAGAIN)
|
||||||
return true;
|
return true;
|
||||||
}
|
#endif /* _MSC_VER */
|
||||||
|
|
||||||
String output = m_OutputStream.str();
|
String output = m_OutputStream.str();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue