Attempting to silence some more "checker" warnings.
authorWayne Davison <wayned@samba.org>
Mon, 17 Mar 2008 14:34:22 +0000 (07:34 -0700)
committerWayne Davison <wayned@samba.org>
Mon, 17 Mar 2008 14:35:19 +0000 (07:35 -0700)
clientserver.c
configure.in
main.c
rsync.h
syscall.c

index a9a1af5..93deb7e 100644 (file)
@@ -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");
        }
 
index be73709..37ad42c 100644 (file)
@@ -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 8de7f1b..95e5a06 100644 (file)
--- 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 c6293d0..d7dcb08 100644 (file)
--- 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
index c2180de..d4ff3f9 100644 (file)
--- 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;