X-Git-Url: https://mattmccutchen.net/rsync/rsync.git/blobdiff_plain/1fb8ec4b0d871f44eeb025b2ea2a1fbfa961234b..4f5b0756df0dfc925b9576db47ecce949c378e18:/lib/compat.c diff --git a/lib/compat.c b/lib/compat.c index 6dd2328a..97b40ffd 100644 --- a/lib/compat.c +++ b/lib/compat.c @@ -116,10 +116,12 @@ { size_t len = strlen(s); size_t ret = len; - if (bufsize <= 0) return 0; - if (len >= bufsize) len = bufsize-1; - memcpy(d, s, len); - d[len] = 0; + if (bufsize > 0) { + if (len >= bufsize) + len = bufsize-1; + memcpy(d, s, len); + d[len] = 0; + } return ret; } #endif @@ -153,7 +155,7 @@ { unsigned char *p = (unsigned char *)&ip.s_addr; static char buf[18]; -#if WORDS_BIGENDIAN +#ifdef WORDS_BIGENDIAN snprintf(buf, 18, "%d.%d.%d.%d", (int)p[0], (int)p[1], (int)p[2], (int)p[3]); #else @@ -194,7 +196,7 @@ /* some systems don't take the 2nd argument */ int sys_gettimeofday(struct timeval *tv) { -#if HAVE_GETTIMEOFDAY_TZ +#ifdef HAVE_GETTIMEOFDAY_TZ return gettimeofday(tv, NULL); #else return gettimeofday(tv);