A couple more xattr improvements:
authorWayne Davison <wayned@samba.org>
Mon, 9 Jun 2008 04:07:30 +0000 (21:07 -0700)
committerWayne Davison <wayned@samba.org>
Mon, 9 Jun 2008 04:14:46 +0000 (21:14 -0700)
- 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.

testsuite/xattrs.test
xattrs.c

index 11b53c5..93e23a9 100644 (file)
@@ -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"
 
index 349fbf4..b2040f2 100644 (file)
--- 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);
                }