Revision 804f5233 output-chunkstream.c

View differences:

output-chunkstream.c
118 118
  }
119 119

  
120 120
  ret = write(fd, sendbuf, pos);
121
  if (ret <= 0) {
122
    perror("Error writing to output");
121
  if (ret < 0) {
122
#ifndef _WIN32
123
    if (ret == -1 &&  (errno == EAGAIN || errno == EWOULDBLOCK)) {
124
#else
125
    if (ret == -1 &&  WSAGetLastError() == WSAEWOULDBLOCK) {
126
#endif
127
      fprintf(stderr,"output-chunkstream: Output stalled ...\n");
128
    } else {
129
      perror("output-chunkstream: Error writing to output");
130
      close(fd);
131
      pos = 0;
132
      fd = -1;
123 133
  } else {
124 134
    pos -= ret;
125 135
    memmove(sendbuf, sendbuf + ret, pos);

Also available in: Unified diff