Fix EA restore in debug mode.
authorStelian Pop <stelian@popies.net>
Mon, 9 Jun 2008 13:25:40 +0000 (13:25 +0000)
committerStelian Pop <stelian@popies.net>
Mon, 9 Jun 2008 13:25:40 +0000 (13:25 +0000)
CHANGES
restore/xattr.c

diff --git a/CHANGES b/CHANGES
index f7c414bcf0b250edbe71296a0061ed900da20ce1..ead4a44e7b78d9ffc818a69a39d12a3b2fa83f5f 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,4 +1,4 @@
-$Id: CHANGES,v 1.293 2008/06/04 19:27:47 stelian Exp $
+$Id: CHANGES,v 1.294 2008/06/09 13:25:40 stelian Exp $
 
 Changes between versions 0.4b41 and 0.4b42 (released xxxxxxxxxxxxxxx)
 =====================================================================
@@ -48,6 +48,8 @@ Changes between versions 0.4b41 and 0.4b42 (released xxxxxxxxxxxxxxx)
        restore. Many thanks to Kenneth Porter <shiva@sewingwitch.com>
        for the bug report and the testing of the fix.
 
+11.    Fix EA restoration in debug mode (Sourceforge bug #1986216).
+
 Changes between versions 0.4b40 and 0.4b41 (released January 2, 2006)
 =====================================================================
 
index 2bb88d0cded5d900529ff39805ab0995e7b85474..4d24a6f281c4473226b225e539fa1be76c2d62ba 100644 (file)
@@ -29,7 +29,7 @@
 
 #ifndef lint
 static const char rcsid[] =
-       "$Id: xattr.c,v 1.4 2007/02/22 20:12:50 stelian Exp $";
+       "$Id: xattr.c,v 1.5 2008/06/09 13:25:40 stelian Exp $";
 #endif /* not lint */
 
 #include <config.h>
@@ -547,6 +547,7 @@ xattr_walk(char *buffer, int (*xattr_cb)(char *, char *, int, int, void *), void
        for (entry = FIRST_ENTRY(buffer); !IS_LAST_ENTRY(entry);
             entry = EXT2_XATTR_NEXT(entry)) {
                char name[XATTR_MAXSIZE], value[XATTR_MAXSIZE];
+               int size;
                int off;
                int convertacl = 0;
                int convertcon = 0;
@@ -583,20 +584,19 @@ xattr_walk(char *buffer, int (*xattr_cb)(char *, char *, int, int, void *), void
                off = strlen(name);
                memcpy(name + off, entry->e_name, entry->e_name_len);
                name[off + entry->e_name_len] = '\0';
+               size = entry->e_value_size;
 
-               memcpy(value, buffer + VALUE_OFFSET(buffer, entry), entry->e_value_size);
+               memcpy(value, buffer + VALUE_OFFSET(buffer, entry), size);
 
                if (convertacl) {
                        struct posix_acl *acl;
-                       int size;
 
-                       acl = ext3_acl_from_disk(value, entry->e_value_size);
+                       acl = ext3_acl_from_disk(value, size);
                        if (!acl)
                                return FAIL;
                        size = posix_acl_to_xattr(acl, value, XATTR_MAXSIZE);
                        if (size < 0)
                                return FAIL;
-                       entry->e_value_size = size;
                        free(acl);
                }
                
@@ -621,14 +621,14 @@ xattr_walk(char *buffer, int (*xattr_cb)(char *, char *, int, int, void *), void
                                return FAIL;
                        }
 
-                       entry->e_value_size = strlen(con) + 1;
+                       size = strlen(con) + 1;
                        value[0] = 0;
                        strncat(value, con, sizeof value);
                        freecon(con);
                }
 #endif
 
-               if (xattr_cb(name, value, entry->e_value_size, convertcon, private) != GOOD)
+               if (xattr_cb(name, value, size, convertcon, private) != GOOD)
                        return FAIL;
        }