SystemExec: tweak writing to stdin of child process
This commit is contained in:
parent
e5eafea128
commit
2522deabda
@ -936,15 +936,15 @@ SystemExec::write_to_stdin (const void* data, size_t bytes)
|
|||||||
while (c < bytes) {
|
while (c < bytes) {
|
||||||
for (;;) {
|
for (;;) {
|
||||||
r = ::write (pin[1], &((const char*)data)[c], bytes - c);
|
r = ::write (pin[1], &((const char*)data)[c], bytes - c);
|
||||||
if (r < 0 && (errno == EINTR || errno == EAGAIN)) {
|
if (r >= 0) {
|
||||||
sleep(1);
|
break;
|
||||||
|
}
|
||||||
|
if (errno == EINTR || errno == EAGAIN) {
|
||||||
|
g_usleep(100000);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if ((size_t) r != (bytes-c)) {
|
::pthread_mutex_unlock(&write_lock);
|
||||||
::pthread_mutex_unlock(&write_lock);
|
return c;
|
||||||
return c;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
c += r;
|
c += r;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user