Revision 1.2 |
Revision 1.3 |
Line 131 |
Line 131 |
int rv = pth_read_ev(fb->fd_in, buf, nbyte, timeout); if (pth_event_status(timeout) == PTH_STATUS_OCCURRED) { errno = EINTR; 
|
int rv = pth_read_ev(fb->fd_in, buf, nbyte, timeout); if (pth_event_status(timeout) == PTH_STATUS_OCCURRED) { errno = EINTR; 
|
printf("DEBUG: READ TIMED OUT\n");
|
|
return -1; } else { return rv;
|
return -1; } else { return rv;
|
Line 458 |
Line 457 |
if (nrd > 0) { eol = strchr(in->inptr, '\n'); if (eol != NULL) {
|
if (nrd > 0) { eol = strchr(in->inptr, '\n'); if (eol != NULL) {
|
int len = (eol - (char*)in->inptr) - 1;
|
int len = (eol - (char*)in->inptr);
|
memcpy(buf, in->inptr, len); in->incnt = nrd - (len+1); in->inptr += (len+1);
|
memcpy(buf, in->inptr, len); in->incnt = nrd - (len+1); in->inptr += (len+1);
|
Line 481 |
Line 480 |
if (nrd > 0) { memcpy(buf, in->inptr, nrd); buf = nrd + (char *) buf;
|
if (nrd > 0) { memcpy(buf, in->inptr, nrd); buf = nrd + (char *) buf;
|
in->incnt = 0;
}
|
}
in->incnt = 0;
|
|
in->inptr = in->inbase;
in->inptr[0] = '\0';
|
if (in->flags & B_EOF) return nrd;
|
if (in->flags & B_EOF) return nrd;
|
Line 491 |
Line 492 |
* than one line in, copy the excess back into the hold buffer. */ i = read_with_errors(in, buf, nbyte, timeout);
|
* than one line in, copy the excess back into the hold buffer. */ i = read_with_errors(in, buf, nbyte, timeout);
|
if (i < 0)
return i;
|
if (i <= 0 || errno == EINTR)
return -1;
|
eol = strchr(buf, '\n'); if (eol != NULL) { int len; /* Copy excess into hold buffer */ if (eol != buf + i - 1) {
|
eol = strchr(buf, '\n'); if (eol != NULL) { int len; /* Copy excess into hold buffer */ if (eol != buf + i - 1) {
|
in->incnt = i - (eol - buf);
|
in->incnt = i - (eol - buf) - 1;
|
memcpy(in->inbase, eol+1, in->incnt); in->inptr = in->inbase; } else {
|
memcpy(in->inbase, eol+1, in->incnt); in->inptr = in->inbase; } else {
|
Line 1207 |
Line 1208 |
}
|
}
|