Same.
2001-10-28 Jeffrey Stedfast <fejj@ximian.com> * camel-tcp-stream-raw.c (stream_write): Same. * camel-stream-fs.c (stream_write): If errno isn't EAGAIN, just exit with -1 and instead of using continue (which doesn't go to the top of the do-while thus making our logic suck), just set w to 0. Still seems to be a bug in select() if it's telling us the socket is ready for data when it really isn't but oh well. svn path=/trunk/; revision=14286
This commit is contained in:
committed by
Jeffrey Stedfast
parent
1d1fed5fb5
commit
2c2cdb4ee5
@@ -1,3 +1,13 @@
|
||||
2001-10-28 Jeffrey Stedfast <fejj@ximian.com>
|
||||
|
||||
* camel-tcp-stream-raw.c (stream_write): Same.
|
||||
|
||||
* camel-stream-fs.c (stream_write): If errno isn't EAGAIN, just
|
||||
exit with -1 and instead of using continue (which doesn't go to
|
||||
the top of the do-while thus making our logic suck), just set w to
|
||||
0. Still seems to be a bug in select() if it's telling us the
|
||||
socket is ready for data when it really isn't but oh well.
|
||||
|
||||
2001-10-28 <NotZed@Ximian.com>
|
||||
|
||||
* providers/local/camel-local-folder.c
|
||||
|
||||
@@ -319,15 +319,19 @@ stream_write (CamelStream *stream, const char *buffer, size_t n)
|
||||
} while (w == -1 && errno == EINTR);
|
||||
|
||||
if (w == -1) {
|
||||
if (errno == EAGAIN)
|
||||
continue;
|
||||
if (errno == EAGAIN) {
|
||||
w = 0;
|
||||
} else {
|
||||
error = errno;
|
||||
fcntl (stream_fs->fd, F_SETFL, flags);
|
||||
errno = error;
|
||||
return -1;
|
||||
}
|
||||
} else
|
||||
written += w;
|
||||
} while (w != -1 && written < n);
|
||||
|
||||
error = errno;
|
||||
fcntl (stream_fs->fd, F_SETFL, flags);
|
||||
errno = error;
|
||||
}
|
||||
|
||||
if (written > 0)
|
||||
|
||||
@@ -127,9 +127,6 @@ tcp_write (int fd, const char *buffer, size_t buflen)
|
||||
printf ("tcp_write (%d, ..., %d): (-1) EINTR\n", fd, buflen);
|
||||
errno = EINTR;
|
||||
return -1;
|
||||
#if 0
|
||||
/* seems that if we set errno to either EAGAIN or
|
||||
EWOULDBLOCK, libc's pthread crashes...wacky */
|
||||
case 2:
|
||||
printf ("tcp_write (%d, ..., %d): (-1) EAGAIN\n", fd, buflen);
|
||||
errno = EAGAIN;
|
||||
@@ -138,7 +135,6 @@ tcp_write (int fd, const char *buffer, size_t buflen)
|
||||
printf ("tcp_write (%d, ..., %d): (-1) EWOULDBLOCK\n", fd, buflen);
|
||||
errno = EWOULDBLOCK;
|
||||
return -1;
|
||||
#endif
|
||||
case 4:
|
||||
case 5:
|
||||
case 6:
|
||||
@@ -278,15 +274,19 @@ stream_write (CamelStream *stream, const char *buffer, size_t n)
|
||||
} while (w == -1 && errno == EINTR);
|
||||
|
||||
if (w == -1) {
|
||||
if (errno == EAGAIN || errno == EWOULDBLOCK)
|
||||
continue;
|
||||
if (errno == EAGAIN || errno == EWOULDBLOCK) {
|
||||
w = 0;
|
||||
} else {
|
||||
error = errno;
|
||||
fcntl (tcp_stream_raw->sockfd, F_SETFL, flags);
|
||||
errno = error;
|
||||
return -1;
|
||||
}
|
||||
} else
|
||||
written += w;
|
||||
} while (w != -1 && written < n);
|
||||
|
||||
error = errno;
|
||||
fcntl (tcp_stream_raw->sockfd, F_SETFL, flags);
|
||||
errno = error;
|
||||
}
|
||||
|
||||
return written;
|
||||
|
||||
Reference in New Issue
Block a user