aboutsummaryrefslogtreecommitdiffstats
path: root/camel/camel-tcp-stream-raw.c
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@ximian.com>2001-10-28 15:03:32 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2001-10-28 15:03:32 +0800
commit2c2cdb4ee5692f72077c2afef8bea62ad5589766 (patch)
treecf8c78689582b854b8ce40378566eb9ffdd5aab0 /camel/camel-tcp-stream-raw.c
parent1d1fed5fb52dc3de130d59badfed22fb919942d4 (diff)
downloadgsoc2013-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
Diffstat (limited to 'camel/camel-tcp-stream-raw.c')
-rw-r--r--camel/camel-tcp-stream-raw.c16
1 files changed, 8 insertions, 8 deletions
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;