From e9ec71193bbbe7e98ebf68ce3e714cfc7c6c33a5 Mon Sep 17 00:00:00 2001 From: Tim Kientzle Date: Sun, 6 Dec 2009 18:52:35 -0500 Subject: [PATCH] Style: Break some long lines. Also, restructure the index number handling to include a truncation check. SVN-Revision: 1714 --- libarchive/archive_write_set_format_cpio_newc.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/libarchive/archive_write_set_format_cpio_newc.c b/libarchive/archive_write_set_format_cpio_newc.c index 1253aa6d3..9dbfbbba5 100644 --- a/libarchive/archive_write_set_format_cpio_newc.c +++ b/libarchive/archive_write_set_format_cpio_newc.c @@ -114,6 +114,7 @@ archive_write_set_format_cpio_newc(struct archive *_a) static int archive_write_newc_header(struct archive_write *a, struct archive_entry *entry) { + int64_t ino; struct cpio *cpio; const char *p, *path; int pathlength, ret, ret2; @@ -128,14 +129,19 @@ archive_write_newc_header(struct archive_write *a, struct archive_entry *entry) memset(&h, 0, sizeof(h)); format_hex(0x070701, &h.c_magic, sizeof(h.c_magic)); - format_hex(archive_entry_devmajor(entry), &h.c_devmajor, sizeof(h.c_devmajor)); - format_hex(archive_entry_devminor(entry), &h.c_devminor, sizeof(h.c_devminor)); - if (archive_entry_ino64(entry) > 0xffffffff) { - archive_set_error(&a->archive, ERANGE, "large inode number truncated"); + format_hex(archive_entry_devmajor(entry), &h.c_devmajor, + sizeof(h.c_devmajor)); + format_hex(archive_entry_devminor(entry), &h.c_devminor, + sizeof(h.c_devminor)); + + ino = archive_entry_ino64(entry); + if (ino > 0xffffffff) { + archive_set_error(&a->archive, ERANGE, + "large inode number truncated"); ret2 = ARCHIVE_WARN; } - format_hex(archive_entry_ino64(entry) & 0xffffffff, &h.c_ino, sizeof(h.c_ino)); + format_hex(ino & 0xffffffff, &h.c_ino, sizeof(h.c_ino)); format_hex(archive_entry_mode(entry), &h.c_mode, sizeof(h.c_mode)); format_hex(archive_entry_uid(entry), &h.c_uid, sizeof(h.c_uid)); format_hex(archive_entry_gid(entry), &h.c_gid, sizeof(h.c_gid)); -- 2.47.3