From: Wayne Davison Date: Mon, 9 Jun 2008 04:07:30 +0000 (-0700) Subject: A couple more xattr improvements: X-Git-Url: https://mattmccutchen.net/rsync/rsync.git/commitdiff_plain/6283e9ef43dcea5843a12604e27f6b26ef93682d A couple more xattr improvements: - Made the XSTATE_* defines avoid using 0. - Call !XATTR_ABBREV() in recv_xattr_request(). - Improved the "internal abbrev" error message. - Fixed the potential for a directory time glitch in xattrs.diff. --- diff --git a/testsuite/xattrs.test b/testsuite/xattrs.test index 11b53c52..93e23a9b 100644 --- a/testsuite/xattrs.test +++ b/testsuite/xattrs.test @@ -128,7 +128,7 @@ cd "$fromdir" rm "$todir/file2" echo extra >file1 -rsync -aX file1 ../chk/ +rsync -aX . ../chk/ checkit "$RSYNC -aiiX . ../to" "$chkdir" "$todir" diff --git a/xattrs.c b/xattrs.c index 349fbf49..b2040f26 100644 --- a/xattrs.c +++ b/xattrs.c @@ -44,9 +44,9 @@ extern int checksum_seed; #define XATTR_ABBREV(x) ((size_t)((x).name - (x).datum) < (x).datum_len) -#define XSTATE_ABBREV 0 -#define XSTATE_DONE 1 -#define XSTATE_TODO 2 +#define XSTATE_ABBREV 1 +#define XSTATE_DONE 2 +#define XSTATE_TODO 3 #define USER_PREFIX "user." #define UPRE_LEN ((int)sizeof USER_PREFIX - 1) @@ -590,8 +590,9 @@ int recv_xattr_request(struct file_struct *file, int f_in) who_am_i(), num, f_name(file, NULL)); exit_cleanup(RERR_STREAMIO); } - if (rxa->datum_len <= MAX_FULL_DATUM || rxa->datum[0] != XSTATE_ABBREV) { - rprintf(FERROR, "[%s] internal abbrev error!\n", who_am_i()); + if (!XATTR_ABBREV(*rxa) || rxa->datum[0] != XSTATE_ABBREV) { + rprintf(FERROR, "[%s] internal abbrev error on %s (%s, len=%d)!\n", + who_am_i(), f_name(file, NULL), rxa->name, rxa->datum_len); exit_cleanup(RERR_STREAMIO); }