]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
Style: Break some long lines.
authorTim Kientzle <kientzle@gmail.com>
Sun, 6 Dec 2009 23:52:35 +0000 (18:52 -0500)
committerTim Kientzle <kientzle@gmail.com>
Sun, 6 Dec 2009 23:52:35 +0000 (18:52 -0500)
Also, restructure the index number handling to include a truncation
check.

SVN-Revision: 1714

libarchive/archive_write_set_format_cpio_newc.c

index 1253aa6d3f5e6b9d19c91994494f89b3b93cf904..9dbfbbba5bad242491ec62e662a6e1d6c8587137 100644 (file)
@@ -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));