[Rsync-patches] [PATCH 2/3] Add const to start_daemon's "addr" and "host" vars and in access.c.

Matt McCutchen <matt at mattmccutchen.net>
Tue Jan 13 22:16:30 PST 2009


---
 access.c       |   11 ++++++-----
 clientserver.c |    4 ++--
 2 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/access.c b/access.c
index 32ab216..7b01e10 100644
--- a/access.c
+++ b/access.c
@@ -20,14 +20,14 @@
 
 #include "rsync.h"
 
-static int match_hostname(char *host, char *tok)
+static int match_hostname(const char *host, const char *tok)
 {
 	if (!host || !*host)
 		return 0;
 	return wildmatch(tok, host);
 }
 
-static int match_binary(char *b1, char *b2, char *mask, int addrlen)
+static int match_binary(const char *b1, const char *b2, const char *mask, int addrlen)
 {
 	int i;
 
@@ -56,7 +56,7 @@ static void make_mask(char *mask, int plen, int addrlen)
 	return;
 }
 
-static int match_address(char *addr, char *tok)
+static int match_address(const char *addr, const char *tok)
 {
 	char *p;
 	struct addrinfo hints, *resa, *rest;
@@ -210,7 +210,7 @@ static int match_address(char *addr, char *tok)
 	return ret;
 }
 
-static int access_match(char *list, char *addr, char *host)
+static int access_match(const char *list, const char *addr, const char *host)
 {
 	char *tok;
 	char *list2 = strdup(list);
@@ -236,7 +236,8 @@ static int access_match(char *list, char *addr, char *host)
 	return 0;
 }
 
-int allow_access(char *addr, char *host, char *allow_list, char *deny_list)
+int allow_access(const char *addr, const char *host,
+		const char *allow_list, const char *deny_list)
 {
 	if (allow_list && !*allow_list)
 		allow_list = NULL;
diff --git a/clientserver.c b/clientserver.c
index 09fd315..6fc3bbe 100644
--- a/clientserver.c
+++ b/clientserver.c
@@ -405,7 +405,7 @@ static int path_failure(int f_out, const char *dir, BOOL was_chdir)
 	return -1;
 }
 
-static int rsync_module(int f_in, int f_out, int i, char *addr, char *host)
+static int rsync_module(int f_in, int f_out, int i, const char *addr, const char *host)
 {
 	int argc;
 	char **argv, **orig_argv, **orig_early_argv, *module_chdir;
@@ -914,7 +914,7 @@ static int load_config(int globals_only)
 int start_daemon(int f_in, int f_out)
 {
 	char line[1024];
-	char *addr, *host;
+	const char *addr, *host;
 	int i;
 
 	io_set_sock_fds(f_in, f_out);
-- 
1.6.1.86.g57f37





More information about the rsync-patches mailing list