]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
Use portable archive_entry_filetype() where we can.
authorTim Kientzle <kientzle@gmail.com>
Fri, 17 Jul 2009 06:07:07 +0000 (02:07 -0400)
committerTim Kientzle <kientzle@gmail.com>
Fri, 17 Jul 2009 06:07:07 +0000 (02:07 -0400)
SVN-Revision: 1232

tar/read.c
tar/write.c

index 3d26a3a5eecdf5d768dec3baedcd1e36b03e8cf4..960ad4f025169698df2bea10cc42e6210611bab9 100644 (file)
@@ -402,7 +402,8 @@ list_item_verbose(struct bsdtar *bsdtar, FILE *out, struct archive_entry *entry)
         * total width of group and devnum/filesize fields be gs_width.
         * If gs_width is too small, grow it.
         */
-       if (S_ISCHR(st->st_mode) || S_ISBLK(st->st_mode)) {
+       if (archive_entry_filetype(entry) == AE_IFCHR
+           || archive_entry_filetype(entry) == AE_IFBLK) {
                sprintf(tmp, "%lu,%lu",
                    (unsigned long)major(st->st_rdev),
                    (unsigned long)minor(st->st_rdev)); /* ls(1) also casts here. */
@@ -441,6 +442,6 @@ list_item_verbose(struct bsdtar *bsdtar, FILE *out, struct archive_entry *entry)
        if (archive_entry_hardlink(entry)) /* Hard link */
                safe_fprintf(out, " link to %s",
                    archive_entry_hardlink(entry));
-       else if (S_ISLNK(st->st_mode)) /* Symbolic link */
+       else if (archive_entry_symlink(entry)) /* Symbolic link */
                safe_fprintf(out, " -> %s", archive_entry_symlink(entry));
 }
index 591a3da26875b84161ed40b6c89f24daea4699ff..66c3916b2c8c68ab6ae8d283173b86d1705d407e 100644 (file)
@@ -912,7 +912,7 @@ write_hierarchy(struct bsdtar *bsdtar, struct archive *a, const char *path)
                            archive_entry_pathname(entry));
 
                /* Non-regular files get archived with zero size. */
-               if (!S_ISREG(st->st_mode))
+               if (archive_entry_filetype(entry) != AE_IFREG)
                        archive_entry_set_size(entry, 0);
 
                archive_entry_linkify(bsdtar->resolver, &entry, &spare_entry);