diff options
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | configure.ac | 25 | ||||
-rw-r--r-- | popt/poptconfig.c | 16 | ||||
-rw-r--r-- | popt/popthelp.c | 7 | ||||
-rw-r--r-- | popt/poptparse.c | 13 | ||||
-rw-r--r-- | src/clirpc.c | 3 | ||||
-rw-r--r-- | src/compile.c | 5 | ||||
-rw-r--r-- | src/hosts.c | 6 | ||||
-rw-r--r-- | src/rpc.c | 3 | ||||
-rw-r--r-- | src/util.c | 4 | ||||
-rw-r--r-- | src/util.h | 1 |
11 files changed, 48 insertions, 36 deletions
@@ -3,6 +3,7 @@ *.out *.err # binaries +/*.exe distcc distccd distccmon-text diff --git a/configure.ac b/configure.ac index 0b9f136..f8e3b75 100644 --- a/configure.ac +++ b/configure.ac @@ -62,14 +62,13 @@ getpeername(0,0,&len); dnl Android requires -llog for printf and friends dnl and will only run position independent executables AC_MSG_CHECKING([if building on Android]) -AC_TRY_COMPILE([ +AC_TRY_COMPILE([], [ #ifdef __BIONIC__ int ok; (void)ok; #else choke me #endif], -[func("a"); func("a", "b"); func("a", "b", "c")], [AC_MSG_RESULT(yes) LDFLAGS="$LDFLAGS -llog -pie"], [AC_MSG_RESULT(no)]) @@ -399,12 +398,11 @@ if (mmap (NULL, 0, 0, 0, 0, 0) == MAP_FAILED) return 0; #else #error mmap unavailable -#endif], ,[ +#endif], AC_MSG_RESULT(yes), [ + AC_MSG_RESULT(no) AC_DEFINE([MAP_FAILED], [(void *)-1L], [Define if MAP_FAILED constant not available]) ]) -AC_MSG_RESULT() - dnl dnl Test if the preprocessor understand vararg macros @@ -433,9 +431,12 @@ fi AC_CACHE_CHECK([for C99 vsnprintf],rsync_cv_HAVE_C99_VSNPRINTF,[ AC_TRY_RUN([ +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include <sys/types.h> #include <stdarg.h> -void foo(const char *format, ...) { +static int foo(const char *format, ...) { va_list ap; int len; char buf[5]; @@ -443,13 +444,13 @@ void foo(const char *format, ...) { va_start(ap, format); len = vsnprintf(0, 0, format, ap); va_end(ap); - if (len != 5) exit(1); + if (len != 5) return 1; - if (snprintf(buf, 3, "hello") != 5 || strcmp(buf, "he") != 0) exit(1); + if (snprintf(buf, 3, "hello") != 5 || strcmp(buf, "he") != 0) return 1; - exit(0); + return 0; } -main() { foo("hello"); } +int main() { return foo("hello"); } ], rsync_cv_HAVE_C99_VSNPRINTF=yes,rsync_cv_HAVE_C99_VSNPRINTF=no,rsync_cv_HAVE_C99_VSNPRINTF=cross)]) if test x"$rsync_cv_HAVE_C99_VSNPRINTF" = x"yes"; then @@ -462,9 +463,9 @@ AC_TRY_RUN([ #include <sys/types.h> #include <sys/socket.h> -main() { +int main() { int fd[2]; - exit((socketpair(AF_UNIX, SOCK_STREAM, 0, fd) != -1) ? 0 : 1); + return (socketpair(AF_UNIX, SOCK_STREAM, 0, fd) != -1) ? 0 : 1; }], rsync_cv_HAVE_SOCKETPAIR=yes,rsync_cv_HAVE_SOCKETPAIR=no,rsync_cv_HAVE_SOCKETPAIR=cross)]) if test x"$rsync_cv_HAVE_SOCKETPAIR" = x"yes"; then diff --git a/popt/poptconfig.c b/popt/poptconfig.c index a600a92..bd8ac57 100644 --- a/popt/poptconfig.c +++ b/popt/poptconfig.c @@ -6,6 +6,8 @@ file accompanying popt source distributions, available from ftp://ftp.rpm.org/pub/rpm/dist. */ +#include <stdint.h> + #include "system.h" #include "poptint.h" @@ -29,20 +31,20 @@ static void configLine(poptContext con, char * line) /*@=type@*/ line += nameLength; - if (*line == '\0' || !isspace(*line)) return; + if (*line == '\0' || !isspace((uint8_t)*line)) return; - while (*line != '\0' && isspace(*line)) line++; + while (*line != '\0' && isspace((uint8_t)*line)) line++; entryType = line; - while (*line == '\0' || !isspace(*line)) line++; + while (*line == '\0' || !isspace((uint8_t)*line)) line++; *line++ = '\0'; - while (*line != '\0' && isspace(*line)) line++; + while (*line != '\0' && isspace((uint8_t)*line)) line++; if (*line == '\0') return; opt = line; - while (*line == '\0' || !isspace(*line)) line++; + while (*line == '\0' || !isspace((uint8_t)*line)) line++; *line++ = '\0'; - while (*line != '\0' && isspace(*line)) line++; + while (*line != '\0' && isspace((uint8_t)*line)) line++; if (*line == '\0') return; /*@-temptrans@*/ /* FIX: line alias is saved */ @@ -137,7 +139,7 @@ int poptReadConfigFile(poptContext con, const char * fn) case '\n': *dst = '\0'; dst = buf; - while (*dst && isspace(*dst)) dst++; + while (*dst && isspace((uint8_t)*dst)) dst++; if (*dst && *dst != '#') configLine(con, dst); chptr++; diff --git a/popt/popthelp.c b/popt/popthelp.c index 5448eba..d3dfd49 100644 --- a/popt/popthelp.c +++ b/popt/popthelp.c @@ -8,6 +8,7 @@ /* (C) 1998-2002 Red Hat, Inc. -- Licensing details are in the COPYING file accompanying popt source distributions, available from ftp://ftp.rpm.org/pub/rpm/dist. */ +#include <stdint.h> #include "system.h" #include "poptint.h" @@ -335,9 +336,9 @@ static void singleOptionHelp(FILE * fp, int maxLeftCol, char format[30]; ch = help + lineLength - 1; - while (ch > help && !isspace(*ch)) ch--; + while (ch > help && !isspace((uint8_t)*ch)) ch--; if (ch == help) break; /* give up */ - while (ch > (help + 1) && isspace(*ch)) ch--; + while (ch > (help + 1) && isspace((uint8_t)*ch)) ch--; ch++; sprintf(format, "%%.%ds\n%%%ds", (int) (ch - help), indentLength); @@ -345,7 +346,7 @@ static void singleOptionHelp(FILE * fp, int maxLeftCol, fprintf(fp, format, help, " "); /*@=formatconst@*/ help = ch; - while (isspace(*help) && *help) help++; + while (isspace((uint8_t)*help) && *help) help++; helpLength = strlen(help); } /*@=boundsread@*/ diff --git a/popt/poptparse.c b/popt/poptparse.c index a0dea80..d7ca28c 100644 --- a/popt/poptparse.c +++ b/popt/poptparse.c @@ -5,6 +5,7 @@ /* (C) 1998-2002 Red Hat, Inc. -- Licensing details are in the COPYING file accompanying popt source distributions, available from ftp://ftp.rpm.org/pub/rpm/dist. */ +#include <stdint.h> #include "system.h" @@ -81,7 +82,7 @@ int poptParseArgvString(const char * s, int * argcPtr, const char *** argvPtr) if (*src != quote) *buf++ = '\\'; } *buf++ = *src; - } else if (isspace(*src)) { + } else if (isspace((uint8_t)*src)) { if (*argv[argc] != '\0') { buf++, argc++; if (argc == argvAlloced) { @@ -157,7 +158,7 @@ int poptConfigFileToString(FILE *fp, char ** argstrp, /*@unused@*/ int flags) p = line; /* loop until first non-space char or EOL */ - while( *p != '\0' && isspace(*p) ) + while( *p != '\0' && isspace((uint8_t)*p) ) p++; linelen = strlen(p); @@ -169,10 +170,10 @@ int poptConfigFileToString(FILE *fp, char ** argstrp, /*@unused@*/ int flags) q = p; - while (*q != '\0' && (!isspace(*q)) && *q != '=') + while (*q != '\0' && (!isspace((uint8_t)*q)) && *q != '=') q++; - if (isspace(*q)) { + if (isspace((uint8_t)*q)) { /* a space after the name, find next non space */ *q++='\0'; while( *q != '\0' && isspace((int)*q) ) q++; @@ -197,14 +198,14 @@ int poptConfigFileToString(FILE *fp, char ** argstrp, /*@unused@*/ int flags) *q++ = '\0'; /* find next non-space letter of value */ - while (*q != '\0' && isspace(*q)) + while (*q != '\0' && isspace((uint8_t)*q)) q++; if (*q == '\0') continue; /* XXX silently ignore missing value */ /* now, loop and strip all ending whitespace */ x = p + linelen; - while (isspace(*--x)) + while (isspace((uint8_t)*--x)) *x = 0; /* null out last char if space (including fgets() NL) */ /* rest of line accept */ diff --git a/src/clirpc.c b/src/clirpc.c index 606f910..fa0dfad 100644 --- a/src/clirpc.c +++ b/src/clirpc.c @@ -114,7 +114,7 @@ int dcc_r_result_header(int ifd, unsigned vers; int ret; - if ((ret = dcc_r_token_int(ifd, "DONE", &vers))) + if ((ret = dcc_r_token_int(ifd, "DONE", &vers))) { rs_log_error("server provided no answer. " "Is the server configured to allow access from your IP" " address? Is the server performing authentication and" @@ -122,6 +122,7 @@ int dcc_r_result_header(int ifd, " installed? Is the server configured to access the" " compiler?"); return ret; + } if (vers != expect_ver) { rs_log_error("got version %d not %d in response from server", diff --git a/src/compile.c b/src/compile.c index f1fd5c3..3496456 100644 --- a/src/compile.c +++ b/src/compile.c @@ -575,6 +575,7 @@ static int dcc_gcc_rewrite_fqn(char **argv) const char *target_with_vendor = GNU_HOST; char *newcmd, *t, *path; int pathlen = 0; + int newcmd_len = 0; if (strcmp(argv[0], "gcc") == 0 || strncmp(argv[0], "gcc-", strlen("gcc-")) == 0 || strcmp(argv[0], "g++") == 0 || strncmp(argv[0], "g++-", strlen("g++-")) == 0) @@ -583,9 +584,11 @@ static int dcc_gcc_rewrite_fqn(char **argv) return -ENOENT; - newcmd = malloc(strlen(target_with_vendor) + 1 + strlen(argv[0] + 1)); + newcmd_len = strlen(target_with_vendor) + 1 + strlen(argv[0] + 1); + newcmd = malloc(newcmd_len); if (!newcmd) return -ENOMEM; + memset(newcmd, 0, newcmd_len); if ((t = strstr(target_with_vendor, "-pc-"))) { memcpy(newcmd, target_with_vendor, t - target_with_vendor); diff --git a/src/hosts.c b/src/hosts.c index 80ee2d7..065b287 100644 --- a/src/hosts.c +++ b/src/hosts.c @@ -222,7 +222,7 @@ static int dcc_parse_multiplier(const char **psrc, struct dcc_hostdef *hostdef) rs_log_error("bad multiplier \"%s\" in host specification", token); return EXIT_BAD_HOSTSPEC; } - while (isdigit(**psrc)) + while (isdigit((uint8_t)**psrc)) (*psrc)++; hostdef->n_slots = val; } @@ -380,7 +380,7 @@ static int dcc_parse_tcp_host(struct dcc_hostdef *hostdef, token++; hostdef->port = strtol(token, &tail, 10); - if (*tail != '\0' && !isspace(*tail) && *tail != '/' && *tail != ',') { + if (*tail != '\0' && !isspace((uint8_t)*tail) && *tail != '/' && *tail != ',') { rs_log_error("invalid tcp port specification in \"%s\"", token); return EXIT_BAD_HOSTSPEC; } else { @@ -521,7 +521,7 @@ int dcc_parse_hosts(const char *where, const char *source_name, continue; } - if (isspace(where[0])) { + if (isspace((uint8_t)where[0])) { where++; /* skip space */ continue; } @@ -37,6 +37,7 @@ #include <fcntl.h> #include <errno.h> #include <ctype.h> +#include <stdint.h> #include <sys/stat.h> @@ -142,7 +143,7 @@ int dcc_explain_mismatch(const char *buf, extrabuf[l] = '\0'; for (p = extrabuf; *p; p++) - if (!(isprint(*p) || *p == ' ' || *p == '\t')) { + if (!(isprint((uint8_t)*p) || *p == ' ' || *p == '\t')) { *p = '\0'; break; } @@ -183,7 +183,7 @@ int dcc_getenv_bool(const char *name, int default_value) } -#define IS_LEGAL_DOMAIN_CHAR(c) (isalnum(c) || ((c) == '-') || ((c) == '.')) +#define IS_LEGAL_DOMAIN_CHAR(c) (isalnum((uint8_t)c) || ((c) == '-') || ((c) == '.')) /* Copy domain part of hostname to static buffer. * If hostname has no domain part, returns -1. @@ -831,7 +831,7 @@ int dcc_tokenize_string(const char *input, char ***argv_ptr) /* Count the spaces in the string. */ for (for_count = input_copy; *for_count; for_count++) - if (isspace(*for_count)) + if (isspace((uint8_t)*for_count)) n_spaces++; /* The maximum number of space-delimited strings we @@ -24,6 +24,7 @@ #include <setjmp.h> #include <stdio.h> #include <time.h> +#include <stdint.h> /* util.c */ int dcc_timecmp(struct timeval a, struct timeval b); |