Branch: Tag:

2014-12-04

2014-12-04 19:23:10 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Pipe.pipe: Added some protection against EINTR for lseek(2).

328:    char *data = s->str;    ptrdiff_t bytes;    -  fd_lseek(THIS->fd, THIS->pos, SEEK_SET); +  while ((fd_lseek(THIS->fd, THIS->pos, SEEK_SET) < 0) && (errno == EINTR)) +  ;    while (len > 0) {    do {    bytes = fd_write(THIS->fd, data, len);
491:    if (sz <= 0) return NULL; /* no data */    if (sz > READ_BUFFER_SIZE) sz = READ_BUFFER_SIZE;    THREADS_ALLOW(); -  fd_lseek(this->fd, pos, SEEK_SET); +  while ((fd_lseek(this->fd, pos, SEEK_SET) < 0) && (errno == EINTR)) +  ;    THREADS_DISALLOW();    do {    THREADS_ALLOW();
901:    char *data;    b=THIS->firstbuffer;    THIS->firstbuffer=b->next; -  fd_lseek(THIS->fd, THIS->pos, SEEK_SET); +  while ((fd_lseek(THIS->fd, THIS->pos, SEEK_SET) < 0) && +  (errno == EINTR)) +  ;       len = b->s->len;    data = b->s->str;