From 1b51530afbc5dff413ea0090834d92e1d96e96e9 Mon Sep 17 00:00:00 2001 From: runge Date: Tue, 4 Jul 2006 19:55:28 +0000 Subject: [PATCH] x11vnc: remove compiler warnings; HP-UX tweaks. --- configure.ac | 7 +++++++ x11vnc/README | 2 +- x11vnc/inet.c | 2 +- x11vnc/keyboard.c | 2 +- x11vnc/sslhelper.c | 8 ++++++++ x11vnc/unixpw.c | 6 +++--- x11vnc/user.c | 4 ++-- x11vnc/util.c | 6 +++--- x11vnc/v4l.c | 4 ++-- x11vnc/x11vnc.c | 8 ++++---- x11vnc/x11vnc.h | 4 ++++ 11 files changed, 36 insertions(+), 17 deletions(-) diff --git a/configure.ac b/configure.ac index 8555da3..5169bef 100644 --- a/configure.ac +++ b/configure.ac @@ -445,6 +445,13 @@ AC_FUNC_VPRINTF AC_FUNC_FORK AC_CHECK_LIB(nsl,gethostbyname) AC_CHECK_LIB(socket,socket) + +uname_s=`(uname -s) 2>/dev/null` +if test "x$uname_s" = "xHP-UX"; then + # need -lsec for getspnam() + LDFLAGS="$LDFLAGS -lsec" +fi + AC_CHECK_FUNCS([ftime gethostbyname gethostname gettimeofday inet_ntoa memmove memset mmap mkfifo select socket strchr strcspn strdup strerror strstr setsid setpgrp getpwuid getpwnam getspnam getuid geteuid setuid setgid seteuid setegid waitpid setutxent grantpt]) # check, if shmget is in cygipc.a diff --git a/x11vnc/README b/x11vnc/README index 1390af5..baaa6d3 100644 --- a/x11vnc/README +++ b/x11vnc/README @@ -1,5 +1,5 @@ -x11vnc README file Date: Tue Jul 4 12:02:55 EDT 2006 +x11vnc README file Date: Tue Jul 4 14:26:15 EDT 2006 The following information is taken from these URLs: diff --git a/x11vnc/inet.c b/x11vnc/inet.c index 3095f37..4754381 100644 --- a/x11vnc/inet.c +++ b/x11vnc/inet.c @@ -97,7 +97,7 @@ char *ip2host(char *ip) { int dotted_ip(char *host) { char *p = host; while (*p != '\0') { - if (*p == '.' || isdigit(*p)) { + if (*p == '.' || isdigit((unsigned char) (*p))) { p++; continue; } diff --git a/x11vnc/keyboard.c b/x11vnc/keyboard.c index a2ae349..d056d05 100644 --- a/x11vnc/keyboard.c +++ b/x11vnc/keyboard.c @@ -579,7 +579,7 @@ static void add_dead_keysyms(char *str) { p = str; while (*p != '\0') { - if (isspace(*p)) { + if (isspace((unsigned char) (*p))) { *p = '\0'; } p++; diff --git a/x11vnc/sslhelper.c b/x11vnc/sslhelper.c index 05f2b33..8131393 100644 --- a/x11vnc/sslhelper.c +++ b/x11vnc/sslhelper.c @@ -1170,7 +1170,11 @@ static void csock_timeout (int sig) { static int wait_conn(int sock) { int conn; struct sockaddr_in addr; +#ifdef __hpux + int addrlen = sizeof(addr); +#else socklen_t addrlen = sizeof(addr); +#endif signal(SIGALRM, csock_timeout); csock_timeout_sock = sock; @@ -1262,7 +1266,11 @@ void accept_openssl(int mode) { int sock = -1, listen = -1, cport, csock, vsock; int status, n, i, db = 0; struct sockaddr_in addr; +#ifdef __hpux + int addrlen = sizeof(addr); +#else socklen_t addrlen = sizeof(addr); +#endif rfbClientPtr client; pid_t pid; char uniq[] = "__evilrats__"; diff --git a/x11vnc/unixpw.c b/x11vnc/unixpw.c index 8402ea8..6e3da94 100644 --- a/x11vnc/unixpw.c +++ b/x11vnc/unixpw.c @@ -358,7 +358,7 @@ int crypt_verify(char *user, char *pass) { if (db > 1) fprintf(stderr, "realpw='%s'\n", realpw); - if (strlen(realpw) < 10) { + if (strlen(realpw) < 12) { /* e.g. "x", try getspnam(), sometimes root for inetd, etc */ #if LIBVNCSERVER_HAVE_GETSPNAM struct spwd *sp = getspnam(user); @@ -680,11 +680,11 @@ if (db) fprintf(stderr, "%s", buf); } if (n == 1) { - if (isspace(buf[0])) { + if (isspace((unsigned char) buf[0])) { i--; continue; } - instr[j++] = tolower(buf[0]); + instr[j++] = tolower((unsigned char)buf[0]); } if (n <= 0 || strstr(pstr, instr) != pstr) { if (db) { diff --git a/x11vnc/user.c b/x11vnc/user.c index 8b0bbbb..c08f27c 100644 --- a/x11vnc/user.c +++ b/x11vnc/user.c @@ -244,7 +244,7 @@ static void user2uid(char *user, uid_t *uid, char **name, char **home) { q = user; while (*q) { - if (! isdigit(*q++)) { + if (! isdigit((unsigned char) (*q++))) { numerical = 0; break; } @@ -810,7 +810,7 @@ int read_passwds(char *passfile) { } p = line; while (*p != '\0') { - if (! isspace(*p)) { + if (! isspace((unsigned char) (*p))) { blank = 0; break; } diff --git a/x11vnc/util.c b/x11vnc/util.c index 64220d0..aa0fb79 100644 --- a/x11vnc/util.c +++ b/x11vnc/util.c @@ -103,7 +103,7 @@ void lowercase(char *str) { } p = str; while (*p != '\0') { - *p = tolower(*p); + *p = tolower((unsigned char) (*p)); p++; } } @@ -115,7 +115,7 @@ void uppercase(char *str) { } p = str; while (*p != '\0') { - *p = toupper(*p); + *p = toupper((unsigned char) (*p)); p++; } } @@ -123,7 +123,7 @@ void uppercase(char *str) { char *lblanks(char *str) { char *p = str; while (*p != '\0') { - if (! isspace(*p)) { + if (! isspace((unsigned char) (*p))) { break; } p++; diff --git a/x11vnc/v4l.c b/x11vnc/v4l.c index 38ab5cb..9209a3f 100644 --- a/x11vnc/v4l.c +++ b/x11vnc/v4l.c @@ -1471,7 +1471,7 @@ static void init_freqtab(char *file) { if (*q == ']') { break; } - if (! isdigit(*q)) { + if (! isdigit((unsigned char) (*q))) { if (0) fprintf(stderr, "extra: %s\n", p); extra++; ok = 0; @@ -1508,7 +1508,7 @@ static void init_freqtab(char *file) { if (*q == ']') { break; } - if (! isdigit(*q)) { + if (! isdigit((unsigned char) (*q))) { extra++; currn = maxn + extra; ok = 0; diff --git a/x11vnc/x11vnc.c b/x11vnc/x11vnc.c index 892adba..047858c 100644 --- a/x11vnc/x11vnc.c +++ b/x11vnc/x11vnc.c @@ -754,7 +754,7 @@ static void check_rcfile(int argc, char **argv) { *(q-1) = ' '; break; } - while (isspace(*q)) { + while (isspace((unsigned char) (*q))) { *q = '\0'; if (q == p) { break; @@ -770,7 +770,7 @@ static void check_rcfile(int argc, char **argv) { if (*q == '\0') { q--; } - while (isspace(*q)) { + while (isspace((unsigned char) (*q))) { *q = '\0'; if (q == p) { break; @@ -793,7 +793,7 @@ static void check_rcfile(int argc, char **argv) { q = buf; while (*q) { i++; - if (*q == '\n' || isspace(*q)) { + if (*q == '\n' || isspace((unsigned char) (*q))) { break; } q++; @@ -1916,7 +1916,7 @@ int main(int argc, char* argv[]) { if (*s == '-') { s++; } - if (isdigit(*s)) { + if (isdigit((unsigned char) (*s))) { no_repeat_countdown = atoi(argv[++i]); } } diff --git a/x11vnc/x11vnc.h b/x11vnc/x11vnc.h index c8431f7..dcbc3a3 100644 --- a/x11vnc/x11vnc.h +++ b/x11vnc/x11vnc.h @@ -19,6 +19,10 @@ #include #include #include +#ifdef __hpux +/* to avoid select() compiler warning */ +#include +#endif #include #include