summaryrefslogtreecommitdiff
path: root/vio/vio.c
diff options
context:
space:
mode:
authorunknown <evgen@moonbone.local>2005-10-13 17:17:32 +0400
committerunknown <evgen@moonbone.local>2005-10-13 17:17:32 +0400
commit8b6ba46c2c957ca23e4d8440e53369f485c85c86 (patch)
tree3b306436788cb89a4776bc07a508684c67ea4f08 /vio/vio.c
parent228d5c42fae46260671478961de9646f6cc4925f (diff)
parent341fbced18ad7f81ceba4c2dcc88badc1b7a3682 (diff)
downloadmariadb-git-8b6ba46c2c957ca23e4d8440e53369f485c85c86.tar.gz
Merge epotemkin@bk-internal.mysql.com:/home/bk/mysql-4.1
into moonbone.local:/work/13535-bug-4.1-mysql mysql-test/r/select.result: Auto merged mysql-test/t/select.test: Auto merged
Diffstat (limited to 'vio/vio.c')
-rw-r--r--vio/vio.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/vio/vio.c b/vio/vio.c
index 45572b93ed6..f60a53d2f04 100644
--- a/vio/vio.c
+++ b/vio/vio.c
@@ -136,10 +136,18 @@ Vio *vio_new(my_socket sd, enum enum_vio_type type, my_bool localhost)
vio->sd);
#if !defined(__WIN__) && !defined(__EMX__) && !defined(OS2)
#if !defined(NO_FCNTL_NONBLOCK)
-#if defined(__FreeBSD__)
- fcntl(sd, F_SETFL, vio->fcntl_mode); /* Yahoo! FreeBSD patch */
-#endif
- vio->fcntl_mode = fcntl(sd, F_GETFL);
+ /*
+ We call fcntl() to set the flags and then immediately read them back
+ to make sure that we and the system are in agreement on the state of
+ things.
+
+ An example of why we need to do this is FreeBSD (and apparently some
+ other BSD-derived systems, like Mac OS X), where the system sometimes
+ reports that the socket is set for non-blocking when it really will
+ block.
+ */
+ fcntl(sd, F_SETFL, vio->fcntl_mode);
+ vio->fcntl_mode= fcntl(sd, F_GETFL);
#elif defined(HAVE_SYS_IOCTL_H) /* hpux */
/* Non blocking sockets doesn't work good on HPUX 11.0 */
(void) ioctl(sd,FIOSNBIO,0);