/* Read the output from the child terminal before the prompt. If no data in
* 200 ms, we stop reading to give the password */
g_info("Reading from child console...");
+ sleep(1); /* make sure the child is ready */
while(1) {
pollfd.fd = fdpty;
- pollfd.events = POLLIN|POLLPRI;
+ pollfd.events = POLLIN|POLLPRI|POLLERR|POLLHUP|POLLNVAL;
num_rdy = poll(&pollfd, 1, 200);
#if 0
while(1) {
int num_hup = 0;
pollfd.fd = fdpty;
- pollfd.events = POLLIN|POLLPRI;
+ pollfd.events = POLLIN|POLLPRI|POLLERR|POLLHUP|POLLNVAL;
num_rdy = poll(&pollfd, 1, -1);
#if 0