From: Tim Kientzle Date: Tue, 24 Jan 2012 06:43:52 +0000 (-0500) Subject: Issue 232: Restructure this so that r is correctly set X-Git-Tag: v3.0.4~2^2~152 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=27b361c494d26035e25024febf22bfd1cc19e0e9;p=thirdparty%2Flibarchive.git Issue 232: Restructure this so that r is correctly set before being used. SVN-Revision: 4202 --- diff --git a/libarchive/archive_acl.c b/libarchive/archive_acl.c index e4ce90d0e..f9ec4a238 100644 --- a/libarchive/archive_acl.c +++ b/libarchive/archive_acl.c @@ -504,20 +504,20 @@ archive_acl_text_w(struct archive *a, struct archive_acl *acl, int flags) ap = acl->acl_head; while (ap != NULL) { - r = 0; - if ((ap->type & ARCHIVE_ENTRY_ACL_TYPE_ACCESS) != 0 && - (r = archive_mstring_get_wcs(a, &ap->name, &wname)) - == 0) { - *wp++ = separator; - if (flags & ARCHIVE_ENTRY_ACL_STYLE_EXTRA_ID) - id = ap->id; - else - id = -1; - append_entry_w(&wp, NULL, ap->tag, wname, - ap->permset, id); - count++; - } else if (r < 0 && errno == ENOMEM) - return (NULL); + if ((ap->type & ARCHIVE_ENTRY_ACL_TYPE_ACCESS) != 0) { + r = archive_mstring_get_wcs(a, &ap->name, &wname); + if (r == 0) { + *wp++ = separator; + if (flags & ARCHIVE_ENTRY_ACL_STYLE_EXTRA_ID) + id = ap->id; + else + id = -1; + append_entry_w(&wp, NULL, ap->tag, wname, + ap->permset, id); + count++; + } else if (r < 0 && errno == ENOMEM) + return (NULL); + } ap = ap->next; } } @@ -531,20 +531,21 @@ archive_acl_text_w(struct archive *a, struct archive_acl *acl, int flags) ap = acl->acl_head; count = 0; while (ap != NULL) { - if ((ap->type & ARCHIVE_ENTRY_ACL_TYPE_DEFAULT) != 0 && - (r = archive_mstring_get_wcs(a, &ap->name, - &wname)) == 0) { - if (count > 0) - *wp++ = separator; - if (flags & ARCHIVE_ENTRY_ACL_STYLE_EXTRA_ID) - id = ap->id; - else - id = -1; - append_entry_w(&wp, prefix, ap->tag, - wname, ap->permset, id); - count ++; - } else if (r < 0 && errno == ENOMEM) - return (NULL); + if ((ap->type & ARCHIVE_ENTRY_ACL_TYPE_DEFAULT) != 0) { + r = archive_mstring_get_wcs(a, &ap->name, &wname); + if (r == 0) { + if (count > 0) + *wp++ = separator; + if (flags & ARCHIVE_ENTRY_ACL_STYLE_EXTRA_ID) + id = ap->id; + else + id = -1; + append_entry_w(&wp, prefix, ap->tag, + wname, ap->permset, id); + count ++; + } else if (r < 0 && errno == ENOMEM) + return (NULL); + } ap = ap->next; } }