From cda606b4da9fb9360c9e3be8115162468b56cc28 Mon Sep 17 00:00:00 2001 From: Marco van Wieringen Date: Wed, 27 Jul 2011 11:24:00 +0200 Subject: [PATCH] Tweak lookup of the attr namespace after making sure there are any extended attributes. --- bacula/src/filed/xattr.c | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/bacula/src/filed/xattr.c b/bacula/src/filed/xattr.c index 0be8385ec0..5af66a3277 100644 --- a/bacula/src/filed/xattr.c +++ b/bacula/src/filed/xattr.c @@ -1302,18 +1302,6 @@ static bxattr_exit_code bsd_build_xattr_streams(JCR *jcr, FF_PKT *ff_pkt) for (namespace_index = 0; namespace_index < sizeof(os_default_xattr_namespaces) / sizeof(int); namespace_index++) { attrnamespace = os_default_xattr_namespaces[namespace_index]; - /* - * Convert the numeric attrnamespace into a string representation and make a private copy of that string. - * The extattr_namespace_to_string functions returns a strdupped string which we need to free. - */ - if (extattr_namespace_to_string(attrnamespace, ¤t_attrnamespace) != 0) { - Mmsg2(jcr->errmsg, _("Failed to convert %d into namespace on file \"%s\"\n"), - attrnamespace, jcr->last_fname); - Dmsg2(100, "Failed to convert %d into namespace on file \"%s\"\n", - attrnamespace, jcr->last_fname); - goto bail_out; - } - /* * First get the length of the available list with extended attributes. * If we get EPERM on system namespace, don't return error. @@ -1333,8 +1321,6 @@ static bxattr_exit_code bsd_build_xattr_streams(JCR *jcr, FF_PKT *ff_pkt) #endif case EPERM: if (attrnamespace == EXTATTR_NAMESPACE_SYSTEM) { - actuallyfree(current_attrnamespace); - current_attrnamespace = NULL; continue; } /* @@ -1383,6 +1369,18 @@ static bxattr_exit_code bsd_build_xattr_streams(JCR *jcr, FF_PKT *ff_pkt) } xattr_list[xattr_list_len] = '\0'; + /* + * Convert the numeric attrnamespace into a string representation and make a private copy of that string. + * The extattr_namespace_to_string functions returns a strdupped string which we need to free. + */ + if (extattr_namespace_to_string(attrnamespace, ¤t_attrnamespace) != 0) { + Mmsg2(jcr->errmsg, _("Failed to convert %d into namespace on file \"%s\"\n"), + attrnamespace, jcr->last_fname); + Dmsg2(100, "Failed to convert %d into namespace on file \"%s\"\n", + attrnamespace, jcr->last_fname); + goto bail_out; + } + /* * Walk the list of extended attributes names and retrieve the data. * We already count the bytes needed for serializing the stream later on. -- 2.39.5