diff options
author | Jeffrey Stedfast <fejj@ximian.com> | 2001-10-28 15:03:32 +0800 |
---|---|---|
committer | Jeffrey Stedfast <fejj@src.gnome.org> | 2001-10-28 15:03:32 +0800 |
commit | 2c2cdb4ee5692f72077c2afef8bea62ad5589766 (patch) | |
tree | cf8c78689582b854b8ce40378566eb9ffdd5aab0 | |
parent | 1d1fed5fb52dc3de130d59badfed22fb919942d4 (diff) | |
download | gsoc2013-evolution-2c2cdb4ee5692f72077c2afef8bea62ad5589766.tar gsoc2013-evolution-2c2cdb4ee5692f72077c2afef8bea62ad5589766.tar.gz gsoc2013-evolution-2c2cdb4ee5692f72077c2afef8bea62ad5589766.tar.bz2 gsoc2013-evolution-2c2cdb4ee5692f72077c2afef8bea62ad5589766.tar.lz gsoc2013-evolution-2c2cdb4ee5692f72077c2afef8bea62ad5589766.tar.xz gsoc2013-evolution-2c2cdb4ee5692f72077c2afef8bea62ad5589766.tar.zst gsoc2013-evolution-2c2cdb4ee5692f72077c2afef8bea62ad5589766.zip |
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
-rw-r--r-- | camel/ChangeLog | 10 | ||||
-rw-r--r-- | camel/camel-stream-fs.c | 12 | ||||
-rw-r--r-- | camel/camel-tcp-stream-raw.c | 16 |
3 files changed, 26 insertions, 12 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog index 64c4914a74..8cb63ba24a 100644 --- a/camel/ChangeLog +++ b/camel/ChangeLog @@ -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 diff --git a/camel/camel-stream-fs.c b/camel/camel-stream-fs.c index 230d3ba6bd..b2eb9d5050 100644 --- a/camel/camel-stream-fs.c +++ b/camel/camel-stream-fs.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) diff --git a/camel/camel-tcp-stream-raw.c b/camel/camel-tcp-stream-raw.c index 5c3ccde0f7..b5d20b61ee 100644 --- a/camel/camel-tcp-stream-raw.c +++ b/camel/camel-tcp-stream-raw.c @@ -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; |