i_stream_skip(pclient->program_input, size);
}
- /* Get exit code */
- if (!pclient->program_input->eof)
+ /* Check for error and EOF. Since we're disconnected, always
+ mark an internal error when not all input is read. This is
+ generally unlikely to occur. */
+ if (pclient->program_input->stream_errno != 0 ||
+ i_stream_have_bytes_left(pclient->program_input))
pclient->exit_code = -1;
} else {
pclient->exit_code = 1;
if (pclient->program_input != NULL &&
!pclient->program_input->closed &&
- !i_stream_is_eof(pclient->program_input)) {
+ i_stream_have_bytes_left(pclient->program_input)) {
return TRUE;
}
for(i = 0; i < count; i++) {
if (efds[i].input != NULL &&
!efds[i].input->closed &&
- !i_stream_is_eof(efds[i].input)) {
+ i_stream_have_bytes_left(efds[i].input)) {
return TRUE;
}
}
i_assert(efd->callback != NULL);
efd->callback(efd->context, efd->input);
- if (efd->input->closed || i_stream_is_eof(efd->input)) {
+ if (efd->input->closed || !i_stream_have_bytes_left(efd->input)) {
if (!program_client_input_pending(pclient))
program_client_disconnect(pclient, FALSE);
}