+/*
+ * For a validated/endian swapped attr_header_t*
+ * ah, endian swap all of the entries.
+ */
+static void
+swap_attrhdr_entries(attr_header_t *ah)
+{
+#if BYTE_ORDER == LITTLE_ENDIAN
+ int i;
+ int count;
+ attr_entry_t *entry;
+ attr_entry_t *next;
+
+ /* If we're in copyfile_pack, num_args is native endian,
+ * if we're in _unpack, num_args is big endian. Use
+ * the magic number to test for endianess.
+ */
+ count = (ah->magic == ATTR_HDR_MAGIC) ? ah->num_attrs : SWAP16(ah->num_attrs);
+
+ entry = (attr_entry_t *)(&ah[1]);
+ for (i = 0; i < count; i++) {
+ next = ATTR_NEXT(entry);
+ swap_attrhdr_entry(entry);
+ entry = next;
+ }
+#else
+ (void)ah;
+#endif
+}