Commit 4fcb6087 authored by dscho's avatar dscho

rfbErr introduced

parent 79c414ab
introduce rfbErr for Errors (Erik)
make rfbLog overridable (suggested by Erik) make rfbLog overridable (suggested by Erik)
don't reutrn on EINTR in WriteExact()/ReadExact() (suggested by Erik) don't reutrn on EINTR in WriteExact()/ReadExact() (suggested by Erik)
use AX_PREFIX_CONFIG_H to prefix constants in config.h to avoid use AX_PREFIX_CONFIG_H to prefix constants in config.h to avoid
......
...@@ -83,7 +83,7 @@ rfbAuthProcessClientMessage(cl) ...@@ -83,7 +83,7 @@ rfbAuthProcessClientMessage(cl)
} }
if(!cl->screen->passwordCheck(cl,(const char*)response,CHALLENGESIZE)) { if(!cl->screen->passwordCheck(cl,(const char*)response,CHALLENGESIZE)) {
rfbLog("rfbAuthProcessClientMessage: password check failed\n"); rfbErr("rfbAuthProcessClientMessage: password check failed\n");
authResult = Swap32IfLE(rfbVncAuthFailed); authResult = Swap32IfLE(rfbVncAuthFailed);
if (WriteExact(cl, (char *)&authResult, 4) < 0) { if (WriteExact(cl, (char *)&authResult, 4) < 0) {
rfbLogPerror("rfbAuthProcessClientMessage: write"); rfbLogPerror("rfbAuthProcessClientMessage: write");
......
...@@ -1135,7 +1135,7 @@ void shm_create(XShmSegmentInfo *shm, XImage **ximg_ptr, int w, int h, ...@@ -1135,7 +1135,7 @@ void shm_create(XShmSegmentInfo *shm, XImage **ximg_ptr, int w, int h,
xim = XShmCreateImage(dpy, visual, bpp, ZPixmap, NULL, shm, w, h); xim = XShmCreateImage(dpy, visual, bpp, ZPixmap, NULL, shm, w, h);
if (xim == NULL) { if (xim == NULL) {
rfbLog( "XShmCreateImage(%s) failed.\n", name); rfbErr( "XShmCreateImage(%s) failed.\n", name);
exit(1); exit(1);
} }
...@@ -1145,7 +1145,7 @@ void shm_create(XShmSegmentInfo *shm, XImage **ximg_ptr, int w, int h, ...@@ -1145,7 +1145,7 @@ void shm_create(XShmSegmentInfo *shm, XImage **ximg_ptr, int w, int h,
xim->bytes_per_line * xim->height, IPC_CREAT | 0777); xim->bytes_per_line * xim->height, IPC_CREAT | 0777);
if (shm->shmid == -1) { if (shm->shmid == -1) {
rfbLog("shmget(%s) failed.\n", name); rfbErr("shmget(%s) failed.\n", name);
perror("shmget"); perror("shmget");
exit(1); exit(1);
} }
...@@ -1153,7 +1153,7 @@ void shm_create(XShmSegmentInfo *shm, XImage **ximg_ptr, int w, int h, ...@@ -1153,7 +1153,7 @@ void shm_create(XShmSegmentInfo *shm, XImage **ximg_ptr, int w, int h,
shm->shmaddr = xim->data = (char *) shmat(shm->shmid, 0, 0); shm->shmaddr = xim->data = (char *) shmat(shm->shmid, 0, 0);
if (shm->shmaddr == (char *)-1) { if (shm->shmaddr == (char *)-1) {
rfbLog("shmat(%s) failed.\n", name); rfbErr("shmat(%s) failed.\n", name);
perror("shmat"); perror("shmat");
exit(1); exit(1);
} }
...@@ -1161,7 +1161,7 @@ void shm_create(XShmSegmentInfo *shm, XImage **ximg_ptr, int w, int h, ...@@ -1161,7 +1161,7 @@ void shm_create(XShmSegmentInfo *shm, XImage **ximg_ptr, int w, int h,
shm->readOnly = False; shm->readOnly = False;
if (! XShmAttach(dpy, shm)) { if (! XShmAttach(dpy, shm)) {
rfbLog("XShmAttach(%s) failed.\n", name); rfbErr("XShmAttach(%s) failed.\n", name);
exit(1); exit(1);
} }
......
...@@ -54,7 +54,7 @@ int main(int argc,char** argv) ...@@ -54,7 +54,7 @@ int main(int argc,char** argv)
rfbScreen = s; rfbScreen = s;
font=rfbLoadConsoleFont(DEFAULTFONT); font=rfbLoadConsoleFont(DEFAULTFONT);
if(!font) { if(!font) {
rfbLog("Couldn't find %s\n",DEFAULTFONT); rfbErr("Couldn't find %s\n",DEFAULTFONT);
exit(1); exit(1);
} }
......
...@@ -410,7 +410,7 @@ KbdAddEvent(rfbBool down, rfbKeySym keySym, struct _rfbClientRec* cl) ...@@ -410,7 +410,7 @@ KbdAddEvent(rfbBool down, rfbKeySym keySym, struct _rfbClientRec* cl)
} }
if (!found) { if (!found) {
rfbLog("warning: couldn't figure out keycode for X keysym %d (0x%x)\n", rfbErr("warning: couldn't figure out keycode for X keysym %d (0x%x)\n",
(int)keySym, (int)keySym); (int)keySym, (int)keySym);
} else { } else {
/* Hopefully I can get away with not specifying a CGCharCode. /* Hopefully I can get away with not specifying a CGCharCode.
......
...@@ -223,7 +223,7 @@ httpProcessInput(rfbScreenInfoPtr rfbScreen) ...@@ -223,7 +223,7 @@ httpProcessInput(rfbScreenInfoPtr rfbScreen)
cl.sock=rfbScreen->httpSock; cl.sock=rfbScreen->httpSock;
if (strlen(rfbScreen->httpDir) > 255) { if (strlen(rfbScreen->httpDir) > 255) {
rfbLog("-httpd directory too long\n"); rfbErr("-httpd directory too long\n");
httpCloseSock(rfbScreen); httpCloseSock(rfbScreen);
return; return;
} }
...@@ -238,7 +238,7 @@ httpProcessInput(rfbScreenInfoPtr rfbScreen) ...@@ -238,7 +238,7 @@ httpProcessInput(rfbScreenInfoPtr rfbScreen)
ssize_t got; ssize_t got;
if (buf_filled > sizeof (buf)) { if (buf_filled > sizeof (buf)) {
rfbLog("httpProcessInput: HTTP request is too long\n"); rfbErr("httpProcessInput: HTTP request is too long\n");
httpCloseSock(rfbScreen); httpCloseSock(rfbScreen);
return; return;
} }
...@@ -248,7 +248,7 @@ httpProcessInput(rfbScreenInfoPtr rfbScreen) ...@@ -248,7 +248,7 @@ httpProcessInput(rfbScreenInfoPtr rfbScreen)
if (got <= 0) { if (got <= 0) {
if (got == 0) { if (got == 0) {
rfbLog("httpd: premature connection close\n"); rfbErr("httpd: premature connection close\n");
} else { } else {
if (errno == EAGAIN) { if (errno == EAGAIN) {
return; return;
...@@ -274,7 +274,7 @@ httpProcessInput(rfbScreenInfoPtr rfbScreen) ...@@ -274,7 +274,7 @@ httpProcessInput(rfbScreenInfoPtr rfbScreen)
const static char* PROXY_OK_STR = "HTTP/1.0 200 OK\r\nContent-Type: octet-stream\r\nPragma: no-cache\r\n\r\n"; const static char* PROXY_OK_STR = "HTTP/1.0 200 OK\r\nContent-Type: octet-stream\r\nPragma: no-cache\r\n\r\n";
if(!strncmp(buf, "CONNECT ", 8)) { if(!strncmp(buf, "CONNECT ", 8)) {
if(atoi(strchr(buf, ':')+1)!=rfbScreen->rfbPort) { if(atoi(strchr(buf, ':')+1)!=rfbScreen->rfbPort) {
rfbLog("httpd: CONNECT format invalid.\n"); rfbErr("httpd: CONNECT format invalid.\n");
WriteExact(&cl,INVALID_REQUEST_STR, strlen(INVALID_REQUEST_STR)); WriteExact(&cl,INVALID_REQUEST_STR, strlen(INVALID_REQUEST_STR));
httpCloseSock(rfbScreen); httpCloseSock(rfbScreen);
return; return;
...@@ -297,7 +297,7 @@ httpProcessInput(rfbScreenInfoPtr rfbScreen) ...@@ -297,7 +297,7 @@ httpProcessInput(rfbScreenInfoPtr rfbScreen)
} }
if (strncmp(buf, "GET ", 4)) { if (strncmp(buf, "GET ", 4)) {
rfbLog("httpd: no GET line\n"); rfbErr("httpd: no GET line\n");
httpCloseSock(rfbScreen); httpCloseSock(rfbScreen);
return; return;
} else { } else {
...@@ -306,26 +306,26 @@ httpProcessInput(rfbScreenInfoPtr rfbScreen) ...@@ -306,26 +306,26 @@ httpProcessInput(rfbScreenInfoPtr rfbScreen)
} }
if (strlen(buf) > maxFnameLen) { if (strlen(buf) > maxFnameLen) {
rfbLog("httpd: GET line too long\n"); rfbErr("httpd: GET line too long\n");
httpCloseSock(rfbScreen); httpCloseSock(rfbScreen);
return; return;
} }
if (sscanf(buf, "GET %s HTTP/1.0", fname) != 1) { if (sscanf(buf, "GET %s HTTP/1.0", fname) != 1) {
rfbLog("httpd: couldn't parse GET line\n"); rfbErr("httpd: couldn't parse GET line\n");
httpCloseSock(rfbScreen); httpCloseSock(rfbScreen);
return; return;
} }
if (fname[0] != '/') { if (fname[0] != '/') {
rfbLog("httpd: filename didn't begin with '/'\n"); rfbErr("httpd: filename didn't begin with '/'\n");
WriteExact(&cl, NOT_FOUND_STR, strlen(NOT_FOUND_STR)); WriteExact(&cl, NOT_FOUND_STR, strlen(NOT_FOUND_STR));
httpCloseSock(rfbScreen); httpCloseSock(rfbScreen);
return; return;
} }
if (strchr(fname+1, '/') != NULL) { if (strchr(fname+1, '/') != NULL) {
rfbLog("httpd: asking for file in other directory\n"); rfbErr("httpd: asking for file in other directory\n");
WriteExact(&cl, NOT_FOUND_STR, strlen(NOT_FOUND_STR)); WriteExact(&cl, NOT_FOUND_STR, strlen(NOT_FOUND_STR));
httpCloseSock(rfbScreen); httpCloseSock(rfbScreen);
return; return;
...@@ -343,7 +343,7 @@ httpProcessInput(rfbScreenInfoPtr rfbScreen) ...@@ -343,7 +343,7 @@ httpProcessInput(rfbScreenInfoPtr rfbScreen)
*ptr = '\0'; *ptr = '\0';
if (!parseParams(&ptr[1], params, 1024)) { if (!parseParams(&ptr[1], params, 1024)) {
params[0] = '\0'; params[0] = '\0';
rfbLog("httpd: bad parameters in the URL\n"); rfbErr("httpd: bad parameters in the URL\n");
} }
} }
......
...@@ -83,10 +83,11 @@ rfbDefaultLog(const char *format, ...) ...@@ -83,10 +83,11 @@ rfbDefaultLog(const char *format, ...)
} }
rfbLogProc rfbLog=rfbDefaultLog; rfbLogProc rfbLog=rfbDefaultLog;
rfbLogProc rfbErr=rfbDefaultLog;
void rfbLogPerror(const char *str) void rfbLogPerror(const char *str)
{ {
rfbLog("%s: %s\n", str, strerror(errno)); rfbErr("%s: %s\n", str, strerror(errno));
} }
void rfbScheduleCopyRegion(rfbScreenInfoPtr rfbScreen,sraRegionPtr copyRegion,int dx,int dy) void rfbScheduleCopyRegion(rfbScreenInfoPtr rfbScreen,sraRegionPtr copyRegion,int dx,int dy)
...@@ -442,7 +443,7 @@ rfbBool defaultPasswordCheck(rfbClientPtr cl,const char* response,int len) ...@@ -442,7 +443,7 @@ rfbBool defaultPasswordCheck(rfbClientPtr cl,const char* response,int len)
char *passwd=vncDecryptPasswdFromFile(cl->screen->rfbAuthPasswdData); char *passwd=vncDecryptPasswdFromFile(cl->screen->rfbAuthPasswdData);
if(!passwd) { if(!passwd) {
rfbLog("Couldn't read password file: %s\n",cl->screen->rfbAuthPasswdData); rfbErr("Couldn't read password file: %s\n",cl->screen->rfbAuthPasswdData);
return(FALSE); return(FALSE);
} }
...@@ -456,7 +457,7 @@ rfbBool defaultPasswordCheck(rfbClientPtr cl,const char* response,int len) ...@@ -456,7 +457,7 @@ rfbBool defaultPasswordCheck(rfbClientPtr cl,const char* response,int len)
free(passwd); free(passwd);
if (memcmp(cl->authChallenge, response, len) != 0) { if (memcmp(cl->authChallenge, response, len) != 0) {
rfbLog("rfbAuthProcessClientMessage: authentication failed from %s\n", rfbErr("rfbAuthProcessClientMessage: authentication failed from %s\n",
cl->host); cl->host);
return(FALSE); return(FALSE);
} }
...@@ -481,7 +482,7 @@ rfbBool rfbCheckPasswordByList(rfbClientPtr cl,const char* response,int len) ...@@ -481,7 +482,7 @@ rfbBool rfbCheckPasswordByList(rfbClientPtr cl,const char* response,int len)
} }
} }
rfbLog("rfbAuthProcessClientMessage: authentication failed from %s\n", rfbErr("rfbAuthProcessClientMessage: authentication failed from %s\n",
cl->host); cl->host);
return(FALSE); return(FALSE);
} }
...@@ -550,7 +551,7 @@ rfbScreenInfoPtr rfbGetScreen(int* argc,char** argv, ...@@ -550,7 +551,7 @@ rfbScreenInfoPtr rfbGetScreen(int* argc,char** argv,
INIT_MUTEX(logMutex); INIT_MUTEX(logMutex);
if(width&3) if(width&3)
rfbLog("WARNING: Width (%d) is not a multiple of 4. VncViewer has problems with that.\n",width); rfbErr("WARNING: Width (%d) is not a multiple of 4. VncViewer has problems with that.\n",width);
rfbScreen->autoPort=FALSE; rfbScreen->autoPort=FALSE;
rfbScreen->rfbClientHead=0; rfbScreen->rfbClientHead=0;
...@@ -667,7 +668,7 @@ void rfbNewFramebuffer(rfbScreenInfoPtr rfbScreen, char *framebuffer, ...@@ -667,7 +668,7 @@ void rfbNewFramebuffer(rfbScreenInfoPtr rfbScreen, char *framebuffer,
old_format = rfbScreen->rfbServerFormat; old_format = rfbScreen->rfbServerFormat;
if (width & 3) if (width & 3)
rfbLog("WARNING: New width (%d) is not a multiple of 4.\n", width); rfbErr("WARNING: New width (%d) is not a multiple of 4.\n", width);
rfbScreen->width = width; rfbScreen->width = width;
rfbScreen->height = height; rfbScreen->height = height;
...@@ -826,7 +827,7 @@ void rfbRunEventLoop(rfbScreenInfoPtr rfbScreen, long usec, rfbBool runInBackgro ...@@ -826,7 +827,7 @@ void rfbRunEventLoop(rfbScreenInfoPtr rfbScreen, long usec, rfbBool runInBackgro
pthread_create(&listener_thread, NULL, listenerRun, rfbScreen); pthread_create(&listener_thread, NULL, listenerRun, rfbScreen);
return; return;
#else #else
rfbLog("Can't run in background, because I don't have PThreads!\n"); rfbErr("Can't run in background, because I don't have PThreads!\n");
return; return;
#endif #endif
} }
......
...@@ -730,7 +730,7 @@ extern rfbBool rfbProcessSizeArguments(int* width,int* height,int* bpp,int* argc ...@@ -730,7 +730,7 @@ extern rfbBool rfbProcessSizeArguments(int* width,int* height,int* bpp,int* argc
extern void rfbLogEnable(int enabled); extern void rfbLogEnable(int enabled);
typedef void (*rfbLogProc)(const char *format, ...); typedef void (*rfbLogProc)(const char *format, ...);
extern rfbLogProc rfbLog; extern rfbLogProc rfbLog, rfbErr;
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);
......
...@@ -759,7 +759,7 @@ rfbBool sraRgnIteratorNext(sraRectangleIterator* i,sraRect* r) ...@@ -759,7 +759,7 @@ rfbBool sraRgnIteratorNext(sraRectangleIterator* i,sraRect* r)
} }
if((i->ptrPos%4)!=2) { if((i->ptrPos%4)!=2) {
rfbLog("sraRgnIteratorNext: offset is wrong (%d%%4!=2)\n",i->ptrPos); rfbErr("sraRgnIteratorNext: offset is wrong (%d%%4!=2)\n",i->ptrPos);
return FALSE; return FALSE;
} }
......
...@@ -521,7 +521,7 @@ rfbProcessClientProtocolVersion(cl) ...@@ -521,7 +521,7 @@ rfbProcessClientProtocolVersion(cl)
if (sscanf(pv,rfbProtocolVersionFormat,&major_,&minor_) != 2) { if (sscanf(pv,rfbProtocolVersionFormat,&major_,&minor_) != 2) {
char name[1024]; char name[1024];
if(sscanf(pv,"RFB %03d.%03d %1024s\n",&major_,&minor_,name) != 3) { if(sscanf(pv,"RFB %03d.%03d %1024s\n",&major_,&minor_,name) != 3) {
rfbLog("rfbProcessClientProtocolVersion: not a valid RFB client\n"); rfbErr("rfbProcessClientProtocolVersion: not a valid RFB client\n");
rfbCloseClient(cl); rfbCloseClient(cl);
return; return;
} }
...@@ -533,7 +533,7 @@ rfbProcessClientProtocolVersion(cl) ...@@ -533,7 +533,7 @@ rfbProcessClientProtocolVersion(cl)
if (major_ != rfbProtocolMajorVersion) { if (major_ != rfbProtocolMajorVersion) {
/* Major version mismatch - send a ConnFailed message */ /* Major version mismatch - send a ConnFailed message */
rfbLog("Major version mismatch\n"); rfbErr("Major version mismatch\n");
sprintf(failureReason, sprintf(failureReason,
"RFB protocol version mismatch - server %d.%d, client %d.%d", "RFB protocol version mismatch - server %d.%d, client %d.%d",
rfbProtocolMajorVersion,rfbProtocolMinorVersion,major_,minor_); rfbProtocolMajorVersion,rfbProtocolMinorVersion,major_,minor_);
...@@ -1448,7 +1448,7 @@ rfbSendRectEncodingRaw(cl, x, y, w, h) ...@@ -1448,7 +1448,7 @@ rfbSendRectEncodingRaw(cl, x, y, w, h)
nlines = (UPDATE_BUF_SIZE - cl->ublen) / bytesPerLine; nlines = (UPDATE_BUF_SIZE - cl->ublen) / bytesPerLine;
if (nlines == 0) { if (nlines == 0) {
rfbLog("rfbSendRectEncodingRaw: send buffer too small for %d " rfbErr("rfbSendRectEncodingRaw: send buffer too small for %d "
"bytes per line\n", bytesPerLine); "bytes per line\n", bytesPerLine);
rfbCloseClient(cl); rfbCloseClient(cl);
return FALSE; return FALSE;
...@@ -1698,7 +1698,7 @@ rfbProcessUDPInput(rfbScreenInfoPtr rfbScreen) ...@@ -1698,7 +1698,7 @@ rfbProcessUDPInput(rfbScreenInfoPtr rfbScreen)
case rfbKeyEvent: case rfbKeyEvent:
if (n != sz_rfbKeyEventMsg) { if (n != sz_rfbKeyEventMsg) {
rfbLog("rfbProcessUDPInput: key event incorrect length\n"); rfbErr("rfbProcessUDPInput: key event incorrect length\n");
rfbDisconnectUDPSock(rfbScreen); rfbDisconnectUDPSock(rfbScreen);
return; return;
} }
...@@ -1707,7 +1707,7 @@ rfbProcessUDPInput(rfbScreenInfoPtr rfbScreen) ...@@ -1707,7 +1707,7 @@ rfbProcessUDPInput(rfbScreenInfoPtr rfbScreen)
case rfbPointerEvent: case rfbPointerEvent:
if (n != sz_rfbPointerEventMsg) { if (n != sz_rfbPointerEventMsg) {
rfbLog("rfbProcessUDPInput: ptr event incorrect length\n"); rfbErr("rfbProcessUDPInput: ptr event incorrect length\n");
rfbDisconnectUDPSock(rfbScreen); rfbDisconnectUDPSock(rfbScreen);
return; return;
} }
...@@ -1716,7 +1716,7 @@ rfbProcessUDPInput(rfbScreenInfoPtr rfbScreen) ...@@ -1716,7 +1716,7 @@ rfbProcessUDPInput(rfbScreenInfoPtr rfbScreen)
break; break;
default: default:
rfbLog("rfbProcessUDPInput: unknown message type %d\n", rfbErr("rfbProcessUDPInput: unknown message type %d\n",
msg.type); msg.type);
rfbDisconnectUDPSock(rfbScreen); rfbDisconnectUDPSock(rfbScreen);
} }
......
...@@ -307,7 +307,7 @@ getBgColour(data,size,bpp) ...@@ -307,7 +307,7 @@ getBgColour(data,size,bpp)
for (j=0; j<size; j++) { for (j=0; j<size; j++) {
k = (int)(((uint8_t *)data)[j]); k = (int)(((uint8_t *)data)[j]);
if (k >= NUMCLRS) { if (k >= NUMCLRS) {
rfbLog("getBgColour: unusual colour = %d\n", k); rfbErr("getBgColour: unusual colour = %d\n", k);
return 0; return 0;
} }
counts[k] += 1; counts[k] += 1;
......
...@@ -474,7 +474,7 @@ WriteExact(cl, buf, len) ...@@ -474,7 +474,7 @@ WriteExact(cl, buf, len)
} else if (n == 0) { } else if (n == 0) {
rfbLog("WriteExact: write returned 0?\n"); rfbErr("WriteExact: write returned 0?\n");
return 0; return 0;
} else { } else {
......
...@@ -259,7 +259,7 @@ rfbSetTranslateFunction(cl) ...@@ -259,7 +259,7 @@ rfbSetTranslateFunction(cl)
#endif #endif
(cl->screen->rfbServerFormat.bitsPerPixel != 32)) (cl->screen->rfbServerFormat.bitsPerPixel != 32))
{ {
rfbLog("%s: server bits per pixel not 8, 16 or 32 (is %d)\n", rfbErr("%s: server bits per pixel not 8, 16 or 32 (is %d)\n",
"rfbSetTranslateFunction", "rfbSetTranslateFunction",
cl->screen->rfbServerFormat.bitsPerPixel); cl->screen->rfbServerFormat.bitsPerPixel);
rfbCloseClient(cl); rfbCloseClient(cl);
...@@ -273,14 +273,14 @@ rfbSetTranslateFunction(cl) ...@@ -273,14 +273,14 @@ rfbSetTranslateFunction(cl)
#endif #endif
(cl->format.bitsPerPixel != 32)) (cl->format.bitsPerPixel != 32))
{ {
rfbLog("%s: client bits per pixel not 8, 16 or 32\n", rfbErr("%s: client bits per pixel not 8, 16 or 32\n",
"rfbSetTranslateFunction"); "rfbSetTranslateFunction");
rfbCloseClient(cl); rfbCloseClient(cl);
return FALSE; return FALSE;
} }
if (!cl->format.trueColour && (cl->format.bitsPerPixel != 8)) { if (!cl->format.trueColour && (cl->format.bitsPerPixel != 8)) {
rfbLog("rfbSetTranslateFunction: client has colour map " rfbErr("rfbSetTranslateFunction: client has colour map "
"but %d-bit - can only cope with 8-bit colour maps\n", "but %d-bit - can only cope with 8-bit colour maps\n",
cl->format.bitsPerPixel); cl->format.bitsPerPixel);
rfbCloseClient(cl); rfbCloseClient(cl);
...@@ -369,7 +369,7 @@ rfbSetClientColourMapBGR233(cl) ...@@ -369,7 +369,7 @@ rfbSetClientColourMapBGR233(cl)
int r, g, b; int r, g, b;
if (cl->format.bitsPerPixel != 8 ) { if (cl->format.bitsPerPixel != 8 ) {
rfbLog("%s: client not 8 bits per pixel\n", rfbErr("%s: client not 8 bits per pixel\n",
"rfbSetClientColourMapBGR233"); "rfbSetClientColourMapBGR233");
rfbCloseClient(cl); rfbCloseClient(cl);
return FALSE; return FALSE;
......
...@@ -57,7 +57,7 @@ void do_key(rfbBool down,rfbKeySym keySym,rfbClientPtr cl) ...@@ -57,7 +57,7 @@ void do_key(rfbBool down,rfbKeySym keySym,rfbClientPtr cl)
tty_inject_device=open(device,O_WRONLY); tty_inject_device=open(device,O_WRONLY);
ret=ioctl(tty_inject_device,TIOCSTI,&keySym); ret=ioctl(tty_inject_device,TIOCSTI,&keySym);
if(ret<0) if(ret<0)
rfbLog("Couldn't reopen device %s!\n",device); rfbErr("Couldn't reopen device %s!\n",device);
} }
} }
} }
...@@ -88,7 +88,7 @@ int main(int argc,char **argv) ...@@ -88,7 +88,7 @@ int main(int argc,char **argv)
if(argc>1) { if(argc>1) {
if((tty=atoi(argv[1]))<1) { if((tty=atoi(argv[1]))<1) {
rfbLog("Usage: %s [tty_number [vnc args]]\n",argv[0]); rfbErr("Usage: %s [tty_number [vnc args]]\n",argv[0]);
exit(1); exit(1);
} else { } else {
argv++; argv++;
...@@ -100,7 +100,7 @@ int main(int argc,char **argv) ...@@ -100,7 +100,7 @@ int main(int argc,char **argv)
sprintf(tty_device,"/dev/tty%d",tty); sprintf(tty_device,"/dev/tty%d",tty);
if((tty_inject_device=open(tty_device,O_WRONLY))<0) { if((tty_inject_device=open(tty_device,O_WRONLY))<0) {
rfbLog("Couldn't open tty device %s!\n",tty_device); rfbErr("Couldn't open tty device %s!\n",tty_device);
exit(1); exit(1);
} }
rfbLog("Using device %s.\n",tty_device); rfbLog("Using device %s.\n",tty_device);
...@@ -142,7 +142,7 @@ int main(int argc,char **argv) ...@@ -142,7 +142,7 @@ int main(int argc,char **argv)
if(!console->currentlyMarking) { if(!console->currentlyMarking) {
tty_file=fopen(tty_device,"rb"); tty_file=fopen(tty_device,"rb");
if(!tty_file) { if(!tty_file) {
rfbLog("cannot open device \"%s\"\n", rfbErr("cannot open device \"%s\"\n",
tty_device); tty_device);
exit(1); exit(1);
} }
......
...@@ -35,7 +35,7 @@ int main(int argc, char **argv) ...@@ -35,7 +35,7 @@ int main(int argc, char **argv)
if(programArg0<argc) { if(programArg0<argc) {
int in[2],out[2],err[2],pid; int in[2],out[2],err[2],pid;
if(pipe(in)<0 || pipe(out)<0 || pipe(err)<0) { if(pipe(in)<0 || pipe(out)<0 || pipe(err)<0) {
rfbLog("Couldn't make pipes!"); rfbErr("Couldn't make pipes!");
return(1); return(1);
} }
......
...@@ -164,7 +164,7 @@ rfbSendOneRectEncodingZlib(cl, x, y, w, h) ...@@ -164,7 +164,7 @@ rfbSendOneRectEncodingZlib(cl, x, y, w, h)
zlibAfterBufLen = cl->compStream.total_out - previousOut; zlibAfterBufLen = cl->compStream.total_out - previousOut;
if ( deflateResult != Z_OK ) { if ( deflateResult != Z_OK ) {
rfbLog("zlib deflation error: %s\n", cl->compStream.msg); rfbErr("zlib deflation error: %s\n", cl->compStream.msg);
return FALSE; return FALSE;
} }
......
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