aboutsummaryrefslogtreecommitdiffstats
path: root/camel/camel-remote-store.c
diff options
context:
space:
mode:
Diffstat (limited to 'camel/camel-remote-store.c')
-rw-r--r--camel/camel-remote-store.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/camel/camel-remote-store.c b/camel/camel-remote-store.c
index 993d9b5778..ef6fe56df0 100644
--- a/camel/camel-remote-store.c
+++ b/camel/camel-remote-store.c
@@ -240,15 +240,16 @@ static int socket_connect(struct hostent *h, int port)
return fd;
} else {
fd_set rdset, wrset;
- long flags;
- int fdmax;
+ int flags, fdmax;
- fcntl(fd, F_GETFL, &flags);
+ flags = fcntl(fd, F_GETFL);
fcntl(fd, F_SETFL, flags | O_NONBLOCK);
ret = connect(fd, (struct sockaddr *)&sin, sizeof (sin));
- if (ret == 0)
+ if (ret == 0) {
+ fcntl(fd, F_SETFL, flags);
return fd;
+ }
if (errno != EINPROGRESS) {
close(fd);