When using the TightVNC 1.3.9 server (Xvnc) on 64-bit Linux (specifically Ubuntu 8.04 and 8.10), the following problems were encountered:
1) The server would crash when serving the Java applet viewer to a client.
2) The server would sometimes fail to open windows.
3) The server would crash when more than a small number of X clients were connected.
This patch addresses these problems.
- Some additional headers were included, so that the proper types were expected for function returns;
- Places where fd_mask variables were treated as integers were corrected, since fd_mask is 64-bits on 64-bit Linux;
- Places where ffs() was called on fd_mask variables were replaced with calls to ffsl (find-first-set-long), which can handle 64-bit values. An implementation of ffsl was supplied for systems without it (Linux has it);
- Places where the fd was being calculated from the offset into an fd_set were corrected to allow for different size fd_mask.
These changes were tested only on 64-bit Ubuntu 8.10.