aboutsummaryrefslogtreecommitdiffstats
path: root/camel
diff options
context:
space:
mode:
Diffstat (limited to 'camel')
-rw-r--r--camel/ChangeLog7
-rw-r--r--camel/camel-stream-fs.c8
2 files changed, 13 insertions, 2 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog
index 91f1d02e5e..d8fd6eaaeb 100644
--- a/camel/ChangeLog
+++ b/camel/ChangeLog
@@ -1,3 +1,10 @@
+2001-10-15 Jeffrey Stedfast <fejj@ximian.com>
+
+ * camel-stream-fs.c (stream_read): Save the errno before calling
+ fcntl so fcntl doesn't overwrite errno in case of a previous
+ error.
+ (stream_write): Same.
+
2001-10-13 Jeffrey Stedfast <fejj@ximian.com>
* providers/smtp/camel-smtp-transport.c (smtp_data): Replace the
diff --git a/camel/camel-stream-fs.c b/camel/camel-stream-fs.c
index f7c5900325..64e4912785 100644
--- a/camel/camel-stream-fs.c
+++ b/camel/camel-stream-fs.c
@@ -232,7 +232,7 @@ stream_read (CamelStream *stream, char *buffer, size_t n)
} while (nread == -1 && errno == EINTR);
} else {
fd_set rdset;
- int flags, fdmax;
+ int error, flags, fdmax;
flags = fcntl(stream_fs->fd, F_GETFL);
fcntl(stream_fs->fd, F_SETFL, flags | O_NONBLOCK);
@@ -247,7 +247,9 @@ stream_read (CamelStream *stream, char *buffer, size_t n)
return -1;
}
nread = read(stream_fs->fd, buffer, n);
+ error = errno;
fcntl(stream_fs->fd, F_SETFL, flags);
+ errno = error;
}
if (nread > 0)
@@ -283,7 +285,7 @@ stream_write (CamelStream *stream, const char *buffer, size_t n)
} while (v == -1 && errno == EINTR);
} else {
fd_set rdset, wrset;
- int flags, fdmax;
+ int error, flags, fdmax;
flags = fcntl(stream_fs->fd, F_GETFL);
fcntl(stream_fs->fd, F_SETFL, flags | O_NONBLOCK);
@@ -303,7 +305,9 @@ stream_write (CamelStream *stream, const char *buffer, size_t n)
if (v>0)
written += v;
} while (v != -1 && written < n);
+ error = errno;
fcntl(stream_fs->fd, F_SETFL, flags);
+ errno = error;
}
if (written > 0)