From aa0e6b9977eff5c5433239a916623a4a3e8a67cb Mon Sep 17 00:00:00 2001 From: Wayne Davison Date: Mon, 17 Mar 2008 07:34:22 -0700 Subject: [PATCH] Attempting to silence some more "checker" warnings. --- clientserver.c | 2 +- configure.in | 6 ++++++ main.c | 2 +- rsync.h | 5 +++++ syscall.c | 2 +- 5 files changed, 14 insertions(+), 3 deletions(-) diff --git a/clientserver.c b/clientserver.c index a9a1af58..93deb7e6 100644 --- a/clientserver.c +++ b/clientserver.c @@ -505,7 +505,7 @@ static int rsync_module(int f_in, int f_out, int i, char *addr, char *host) if ((p = strstr(module_dir, "/./")) != NULL) { *p = '\0'; p += 2; - } else if ((p = strdup("/")) == NULL) + } else if ((p = strdup("/")) == NULL) /* MEMORY LEAK */ out_of_memory("rsync_module"); } diff --git a/configure.in b/configure.in index be737096..37ad42c1 100644 --- a/configure.in +++ b/configure.in @@ -969,6 +969,12 @@ if test x"$enable_acl_support" = x"no" -o x"$enable_xattr_support" = x"no" -o x" fi fi +case "$CC" in +checker*) + AC_DEFINE(FORCE_FD_ZERO_MEMSET, 1, [Used to make "checker" understand that FD_ZERO() clears memory.]) + ;; +esac + AC_CONFIG_FILES([Makefile lib/dummy zlib/dummy popt/dummy shconfig]) AC_OUTPUT diff --git a/main.c b/main.c index 8de7f1bd..95e5a061 100644 --- a/main.c +++ b/main.c @@ -341,7 +341,7 @@ static pid_t do_cmd(char *cmd, char *machine, char *user, char **remote_argv, in cmd = rsh_env; if (!cmd) cmd = RSYNC_RSH; - cmd = strdup(cmd); + cmd = strdup(cmd); /* MEMORY LEAK */ if (!cmd) goto oom; diff --git a/rsync.h b/rsync.h index c6293d0f..d7dcb08a 100644 --- a/rsync.h +++ b/rsync.h @@ -1107,6 +1107,11 @@ size_t strlcat(char *d, const char *s, size_t bufsize); #define MY_GID() getgid() #endif +#ifdef FORCE_FD_ZERO_MEMSET +#undef FD_ZERO +#define FD_ZERO(fdsetp) memset(fdsetp, 0, sizeof (fd_set)) +#endif + extern int verbose; #ifndef HAVE_INET_NTOP diff --git a/syscall.c b/syscall.c index c2180de3..d4ff3f91 100644 --- a/syscall.c +++ b/syscall.c @@ -167,7 +167,7 @@ int do_chmod(const char *path, mode_t mode) code = 1; #endif } else - code = chmod(path, mode & CHMOD_BITS); + code = chmod(path, mode & CHMOD_BITS); /* DISCOURAGED FUNCTION */ if (code != 0 && (preserve_perms || preserve_executability)) return code; return 0; -- 2.34.1