aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@ximian.com>2001-10-16 06:10:19 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2001-10-16 06:10:19 +0800
commitf74417fca812a029732742fcffa433997f91e362 (patch)
tree4a6016684f18623adef7b6b2ba131ba2d75912af
parentdba5f1b79e693d501148d462b14d097d7600fe9d (diff)
downloadgsoc2013-evolution-f74417fca812a029732742fcffa433997f91e362.tar.gz
gsoc2013-evolution-f74417fca812a029732742fcffa433997f91e362.tar.zst
gsoc2013-evolution-f74417fca812a029732742fcffa433997f91e362.zip
Save the errno before calling fcntl so fcntl doesn't overwrite errno in
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. svn path=/trunk/; revision=13687
-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)