diff options
Diffstat (limited to 'camel/camel-stream-fs.c')
-rw-r--r-- | camel/camel-stream-fs.c | 12 |
1 files changed, 8 insertions, 4 deletions
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) |