Commit 48029a3a authored by dscho's avatar dscho

rfbLog can be overridden; EINTR on read/write means just try again

parent ae5142bd
...@@ -59,7 +59,7 @@ void rfbLogEnable(int enabled) { ...@@ -59,7 +59,7 @@ void rfbLogEnable(int enabled) {
*/ */
void void
rfbLog(const char *format, ...) rfbDefaultLog(const char *format, ...)
{ {
va_list args; va_list args;
char buf[256]; char buf[256];
...@@ -82,6 +82,8 @@ rfbLog(const char *format, ...) ...@@ -82,6 +82,8 @@ rfbLog(const char *format, ...)
UNLOCK(logMutex); UNLOCK(logMutex);
} }
rfbLogProc rfbLog=rfbDefaultLog;
void rfbLogPerror(const char *str) void rfbLogPerror(const char *str)
{ {
rfbLog("%s: %s\n", str, strerror(errno)); rfbLog("%s: %s\n", str, strerror(errno));
......
...@@ -729,7 +729,8 @@ extern rfbBool rfbProcessSizeArguments(int* width,int* height,int* bpp,int* argc ...@@ -729,7 +729,8 @@ extern rfbBool rfbProcessSizeArguments(int* width,int* height,int* bpp,int* argc
/* main.c */ /* main.c */
extern void rfbLogEnable(int enabled); extern void rfbLogEnable(int enabled);
extern void rfbLog(const char *format, ...); typedef void (*rfbLogProc)(const char *format, ...);
extern rfbLogProc rfbLog;
extern void rfbLogPerror(const char *str); extern void rfbLogPerror(const char *str);
void rfbScheduleCopyRect(rfbScreenInfoPtr rfbScreen,int x1,int y1,int x2,int y2,int dx,int dy); void rfbScheduleCopyRect(rfbScreenInfoPtr rfbScreen,int x1,int y1,int x2,int y2,int dx,int dy);
......
...@@ -415,6 +415,9 @@ ReadExactTimeout(rfbClientPtr cl, char* buf, int len, int timeout) ...@@ -415,6 +415,9 @@ ReadExactTimeout(rfbClientPtr cl, char* buf, int len, int timeout)
#ifdef WIN32 #ifdef WIN32
errno = WSAGetLastError(); errno = WSAGetLastError();
#endif #endif
if (errno == EINTR)
continue;
if (errno != EWOULDBLOCK && errno != EAGAIN) { if (errno != EWOULDBLOCK && errno != EAGAIN) {
return n; return n;
} }
...@@ -478,6 +481,9 @@ WriteExact(cl, buf, len) ...@@ -478,6 +481,9 @@ WriteExact(cl, buf, len)
#ifdef WIN32 #ifdef WIN32
errno = WSAGetLastError(); errno = WSAGetLastError();
#endif #endif
if (errno == EINTR)
continue;
if (errno != EWOULDBLOCK && errno != EAGAIN) { if (errno != EWOULDBLOCK && errno != EAGAIN) {
UNLOCK(cl->outputMutex); UNLOCK(cl->outputMutex);
return n; return n;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment