[SCM] The rsync repository. - branch master updated

Rsync CVS commit messages rsync-cvs at lists.samba.org
Sat Jan 1 15:02:30 MST 2011


The branch, master has been updated
       via  1c99b1d Report all socket connection errors if we fail. Fixes bug 6588.
       via  575933e Itemize xattrs of a missing dir from an alt-dest dir. Fixes bug 6576.
       via  1401390 Use full_fname() for system error messages.
       via  d1b3118 Tweak the year.
      from  8f30d21 Protect a remote filename that starts with a dash.

;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 1c99b1d956a4cb4dcc36e9ed227a98fb40c1a943
Author: Wayne Davison <wayned at samba.org>
Date:   Sat Jan 1 13:54:16 2011 -0800

    Report all socket connection errors if we fail.
    Fixes bug 6588.

commit 575933e9d0c02626cea924187034b001bd5210f0
Author: Wayne Davison <wayned at samba.org>
Date:   Sat Jan 1 12:54:07 2011 -0800

    Itemize xattrs of a missing dir from an alt-dest dir.
    Fixes bug 6576.

commit 14013906ca0ee2d226f0baba74811f60224c35e2
Author: Wayne Davison <wayned at samba.org>
Date:   Sat Jan 1 12:29:36 2011 -0800

    Use full_fname() for system error messages.

commit d1b3118c16bea5724706bd2074cfec34aff9a899
Author: Wayne Davison <wayned at samba.org>
Date:   Sat Jan 1 11:27:40 2011 -0800

    Tweak the year.

-----------------------------------------------------------------------

Summary of changes:
 OLDNEWS     |    2 +-
 generator.c |    9 ++++++---
 options.c   |    4 ++--
 socket.c    |   28 +++++++++++++++++++++++-----
 xattrs.c    |   18 +++++++++---------
 5 files changed, 41 insertions(+), 20 deletions(-)


Changeset truncated at 500 lines:

diff --git a/OLDNEWS b/OLDNEWS
index 335511c..2731227 100644
--- a/OLDNEWS
+++ b/OLDNEWS
@@ -3094,7 +3094,7 @@ Changes since 2.4.6:
 
 Partial Protocol History
 	RELEASE DATE	VER.	DATE OF COMMIT*	PROTOCOL
-	?? ??? 2010	3.1.0	31 Aug 2008	31
+	?? ??? 2011	3.1.0	31 Aug 2008	31
 	31 Dec 2009	3.0.7			30
 	08 May 2009	3.0.6			30
 	28 Dec 2008	3.0.5			30
diff --git a/generator.c b/generator.c
index 61a2305..32d56ea 100644
--- a/generator.c
+++ b/generator.c
@@ -1282,6 +1282,8 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
 		goto cleanup;
 	}
 
+	fnamecmp = fname;
+
 	if (is_dir) {
 		if (!implied_dirs && file->flags & FLAG_IMPLIED_DIR)
 			goto cleanup;
@@ -1329,11 +1331,13 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
 				itemizing = 0;
 				code = FNONE;
 				statret = 1;
-			} else if (j >= 0)
+			} else if (j >= 0) {
 				statret = 1;
+				fnamecmp = fnamecmpbuf;
+			}
 		}
 		if (itemizing && f_out != -1) {
-			itemize(fname, file, ndx, statret, &sx,
+			itemize(fnamecmp, file, ndx, statret, &sx,
 				statret ? ITEM_LOCAL_CHANGE : 0, 0, NULL);
 		}
 		if (real_ret != 0 && do_mkdir(fname,file->mode) < 0 && errno != EEXIST) {
@@ -1590,7 +1594,6 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
 		goto cleanup;
 	}
 
-	fnamecmp = fname;
 	fnamecmp_type = FNAMECMP_FNAME;
 
 	if (statret == 0 && !S_ISREG(sx.st.st_mode)) {
diff --git a/options.c b/options.c
index dc13592..3dab4a2 100644
--- a/options.c
+++ b/options.c
@@ -3,7 +3,7 @@
  *
  * Copyright (C) 1998-2001 Andrew Tridgell <tridge at samba.org>
  * Copyright (C) 2000, 2001, 2002 Martin Pool <mbp at samba.org>
- * Copyright (C) 2002-2010 Wayne Davison
+ * Copyright (C) 2002-2011 Wayne Davison
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -604,7 +604,7 @@ static void print_rsync_version(enum logcode f)
 
 	rprintf(f, "%s  version %s  protocol version %d%s\n",
 		RSYNC_NAME, RSYNC_VERSION, PROTOCOL_VERSION, subprotocol);
-	rprintf(f, "Copyright (C) 1996-2010 by Andrew Tridgell, Wayne Davison, and others.\n");
+	rprintf(f, "Copyright (C) 1996-2011 by Andrew Tridgell, Wayne Davison, and others.\n");
 	rprintf(f, "Web site: http://rsync.samba.org/\n");
 	rprintf(f, "Capabilities:\n");
 	rprintf(f, "    %d-bit files, %d-bit inums, %d-bit timestamps, %d-bit long ints,\n",
diff --git a/socket.c b/socket.c
index fcb2a3b..8162974 100644
--- a/socket.c
+++ b/socket.c
@@ -182,7 +182,7 @@ int open_socket_out(char *host, int port, const char *bind_addr,
 		    int af_hint)
 {
 	int type = SOCK_STREAM;
-	int error, s;
+	int error, s, j, addr_cnt, *errnos;
 	struct addrinfo hints, *res0, *res;
 	char portbuf[10];
 	char *h, *cp;
@@ -244,12 +244,17 @@ int open_socket_out(char *host, int port, const char *bind_addr,
 		return -1;
 	}
 
+	for (res = res0, addr_cnt = 0; res; res = res->ai_next, addr_cnt++) {}
+	errnos = new_array0(int, addr_cnt);
+	if (!errnos)
+		out_of_memory("open_socket_out");
+
 	s = -1;
 	/* Try to connect to all addresses for this machine until we get
 	 * through.  It might e.g. be multi-homed, or have both IPv4 and IPv6
 	 * addresses.  We need to create a socket for each record, since the
 	 * address record tells us what protocol to use to try to connect. */
-	for (res = res0; res; res = res->ai_next) {
+	for (res = res0, j = 0; res; res = res->ai_next, j++) {
 		s = socket(res->ai_family, res->ai_socktype, res->ai_protocol);
 		if (s < 0)
 			continue;
@@ -280,8 +285,10 @@ int open_socket_out(char *host, int port, const char *bind_addr,
 		if (connect_timeout > 0)
 			alarm(0);
 
-		if (s < 0)
+		if (s < 0) {
+			errnos[j] = errno;
 			continue;
+		}
 
 		if (proxied
 		 && establish_proxy_connection(s, host, port,
@@ -293,10 +300,21 @@ int open_socket_out(char *host, int port, const char *bind_addr,
 		break;
 	}
 	freeaddrinfo(res0);
+
 	if (s < 0) {
-		rsyserr(FERROR, errno, "failed to connect to %s", h);
-		return -1;
+		char buf[2048];
+		for (res = res0, j = 0; res; res = res->ai_next, j++) {
+			if (errnos[j] == 0)
+				continue;
+			if (inet_ntop(res->ai_family, res->ai_addr->sa_data + 2, buf, sizeof buf) == NULL)
+				strlcpy(buf, "*inet_ntop failed*", sizeof buf);
+			rsyserr(FERROR, errnos[j], "failed to connect to %s (%s)", h, buf);
+		}
+		s = -1;
 	}
+
+	free(errnos);
+
 	return s;
 }
 
diff --git a/xattrs.c b/xattrs.c
index fcefebb..df1a2a1 100644
--- a/xattrs.c
+++ b/xattrs.c
@@ -139,7 +139,7 @@ static ssize_t get_xattr_names(const char *fname)
 		  got_error:
 			rsyserr(FERROR_XFER, errno,
 				"get_xattr_names: llistxattr(\"%s\",%s) failed",
-				fname, big_num(arg));
+				full_fname(fname), big_num(arg));
 			return -1;
 		}
 		list_len = sys_llistxattr(fname, NULL, 0);
@@ -175,7 +175,7 @@ static char *get_xattr_data(const char *fname, const char *name, size_t *len_ptr
 			return NULL;
 		rsyserr(FERROR_XFER, errno,
 			"get_xattr_data: lgetxattr(\"%s\",\"%s\",0) failed",
-			fname, name);
+			full_fname(fname), name);
 		return NULL;
 	}
 
@@ -192,11 +192,11 @@ static char *get_xattr_data(const char *fname, const char *name, size_t *len_ptr
 			if (len == (size_t)-1) {
 				rsyserr(FERROR_XFER, errno,
 				    "get_xattr_data: lgetxattr(\"%s\",\"%s\",%ld)"
-				    " failed", fname, name, (long)datum_len);
+				    " failed", full_fname(fname), name, (long)datum_len);
 			} else {
 				rprintf(FERROR_XFER,
 				    "get_xattr_data: lgetxattr(\"%s\",\"%s\",%ld)"
-				    " returned %ld\n", fname, name,
+				    " returned %ld\n", full_fname(fname), name,
 				    (long)datum_len, (long)len);
 			}
 			free(ptr);
@@ -337,7 +337,7 @@ int copy_xattrs(const char *source, const char *dest)
 			int save_errno = errno ? errno : EINVAL;
 			rsyserr(FERROR_XFER, errno,
 				"copy_xattrs: lsetxattr(\"%s\",\"%s\") failed",
-				dest, name);
+				full_fname(dest), name);
 			errno = save_errno;
 			return -1;
 		}
@@ -822,7 +822,7 @@ static int rsync_xal_set(const char *fname, item_list *xalp,
 			else if (sys_lsetxattr(fname, name, ptr, len) < 0) {
 				rsyserr(FERROR_XFER, errno,
 					"rsync_xal_set: lsetxattr(\"%s\",\"%s\") failed",
-					fname, name);
+					full_fname(fname), name);
 				ret = -1;
 			} else /* make sure caller sets mtime */
 				sxp->st.st_mtime = (time_t)-1;
@@ -843,7 +843,7 @@ static int rsync_xal_set(const char *fname, item_list *xalp,
 		if (sys_lsetxattr(fname, name, rxas[i].datum, rxas[i].datum_len) < 0) {
 			rsyserr(FERROR_XFER, errno,
 				"rsync_xal_set: lsetxattr(\"%s\",\"%s\") failed",
-				fname, name);
+				full_fname(fname), name);
 			ret = -1;
 		} else /* make sure caller sets mtime */
 			sxp->st.st_mtime = (time_t)-1;
@@ -873,7 +873,7 @@ static int rsync_xal_set(const char *fname, item_list *xalp,
 			if (sys_lremovexattr(fname, name) < 0) {
 				rsyserr(FERROR_XFER, errno,
 					"rsync_xal_set: lremovexattr(\"%s\",\"%s\") failed",
-					fname, name);
+					full_fname(fname), name);
 				ret = -1;
 			} else /* make sure caller sets mtime */
 				sxp->st.st_mtime = (time_t)-1;
@@ -935,7 +935,7 @@ int set_xattr_acl(const char *fname, int is_access_acl, const char *buf, size_t
 	if (sys_lsetxattr(fname, name, buf, buf_len) < 0) {
 		rsyserr(FERROR_XFER, errno,
 			"set_xattr_acl: lsetxattr(\"%s\",\"%s\") failed",
-			fname, name);
+			full_fname(fname), name);
 		return -1;
 	}
 	return 0;


-- 
The rsync repository.


More information about the rsync-cvs mailing list