diff --git a/ChangeLog b/ChangeLog index 5971e66..8303149 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2005-12-08 "Mazin, Malvina" + * configure.ac, libvncserver/sockets.c: on Solaris 2.7, write may + return ENOENT when it really means EAGAIN. + 2005-12-07 Giampiero Giancipoli * libvncclient/vncviewer.c: plug memory leaks diff --git a/configure.ac b/configure.ac index abb338a..5fe134d 100644 --- a/configure.ac +++ b/configure.ac @@ -360,6 +360,14 @@ AM_CONDITIONAL(LINUX, test -c /dev/vcsa1) AC_CHECK_HEADER(ApplicationServices/ApplicationServices.h, HAVE_OSX="true") AM_CONDITIONAL(OSX, test "$HAVE_OSX" = "true") +# On Solaris 2.7, write() returns ENOENT when it really means EAGAIN +AH_TEMPLATE(ENOENT_WORKAROUND, [work around when write() returns ENOENT but does not mean it]) +case `(uname -sr) 2>/dev/null` in + "SunOS 5.7") + AC_DEFINE(ENOENT_WORKAROUND) + ;; +esac + # Check for rpm SOURCES path printf "checking for rpm sources path... " RPMSOURCEDIR="NOT-FOUND" diff --git a/libvncclient/sockets.c b/libvncclient/sockets.c index 6ee5a9d..aca38aa 100644 --- a/libvncclient/sockets.c +++ b/libvncclient/sockets.c @@ -217,7 +217,11 @@ WriteToRFBServer(rfbClient* client, char *buf, int n) j = write(client->sock, buf + i, (n - i)); if (j <= 0) { if (j < 0) { - if (errno == EWOULDBLOCK || errno == EAGAIN) { + if (errno == EWOULDBLOCK || +#ifdef LIBVNCSERVER_ENOENT_WORKAROUND + errno == ENOENT || +#endif + errno == EAGAIN) { FD_ZERO(&fds); FD_SET(client->sock,&fds); diff --git a/libvncserver/sockets.c b/libvncserver/sockets.c index ca8b995..a225131 100755 --- a/libvncserver/sockets.c +++ b/libvncserver/sockets.c @@ -447,6 +447,9 @@ rfbReadExactTimeout(rfbClientPtr cl, char* buf, int len, int timeout) if (errno == EINTR) continue; +#ifdef LIBVNCSERVER_ENOENT_WORKAROUND + if (errno != ENOENT) +#endif if (errno != EWOULDBLOCK && errno != EAGAIN) { return n; }