X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=bacula%2Fsrc%2Ffiled%2Fxattr.c;h=fe43b042339d89f9ea09da8028b16b3fdd43e32c;hb=f9201647d5ecc4a1b0a2d1de7ca339f50fc5d77b;hp=2b01bff2d88624139d160e251a627a635bfc9cc6;hpb=2df930772a4e8ea92684aea82c3e5cf8a11e55ef;p=bacula%2Fbacula diff --git a/bacula/src/filed/xattr.c b/bacula/src/filed/xattr.c index 2b01bff2d8..fe43b04233 100644 --- a/bacula/src/filed/xattr.c +++ b/bacula/src/filed/xattr.c @@ -40,7 +40,7 @@ * * Written by Marco van Wieringen, November MMVIII * - * Version $Id: xattr.c 7879 2008-10-23 10:12:36Z kerns $ + * Version $Id$ */ #include "bacula.h" @@ -84,6 +84,12 @@ static bool send_xattr_stream(JCR *jcr, int stream) return true; #endif + /* + * Sanity check + */ + if (jcr->xattr_data_len <= 0) + return true; + /* * Send header */ @@ -259,6 +265,7 @@ static bool generic_xattr_build_streams(JCR *jcr, FF_PKT *ff_pkt, int stream) jcr->last_fname, be.bstrerror()); Dmsg2(100, "llistxattr error file=%s ERR=%s\n", jcr->last_fname, be.bstrerror()); + return false; } else if (xattr_list_len == 0) { return true; @@ -286,6 +293,7 @@ static bool generic_xattr_build_streams(JCR *jcr, FF_PKT *ff_pkt, int stream) jcr->last_fname, be.bstrerror()); free(xattr_list); + return false; } xattr_list[xattr_list_len] = '\0'; @@ -295,11 +303,24 @@ static bool generic_xattr_build_streams(JCR *jcr, FF_PKT *ff_pkt, int stream) */ bp = xattr_list; while ((bp - xattr_list) + 1 < xattr_list_len) { +#if defined(HAVE_LINUX_OS) + /* + * On Linux you also get the acls in the extented attribute list. + * So we check if we are already backing up acls and if we do we + * don't store the extended attribute with the same info. + */ + if ((ff_pkt->flags & FO_ACL) == 0 || strcmp(bp, "system.posix_acl_access")) + count++; +#else count++; +#endif bp = strchr(bp, '\0') + 1; } + if (count == 0) + return true; + /* * Allocate enough room to hold all extended attributes. * After allocating the storage make sure its empty by zeroing it. @@ -319,11 +340,6 @@ static bool generic_xattr_build_streams(JCR *jcr, FF_PKT *ff_pkt, int stream) bp = xattr_list; while ((bp - xattr_list) + 1 < xattr_list_len) { #if defined(HAVE_LINUX_OS) - /* - * On Linux you also get the acls in the extented attribute list. - * So we check if we are already backing up acls and if we do we - * don't store the extended attribute with the same info. - */ if (ff_pkt->flags & FO_ACL && !strcmp(bp, "system.posix_acl_access")) { bp = strchr(bp, '\0') + 1;