From 37c0533a32ba46bb94ba77ffa4b6111726a43cff Mon Sep 17 00:00:00 2001 From: Tim Kientzle Date: Fri, 17 Jul 2009 02:07:07 -0400 Subject: [PATCH] Use portable archive_entry_filetype() where we can. SVN-Revision: 1232 --- tar/read.c | 5 +++-- tar/write.c | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/tar/read.c b/tar/read.c index 3d26a3a5e..960ad4f02 100644 --- a/tar/read.c +++ b/tar/read.c @@ -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)); } diff --git a/tar/write.c b/tar/write.c index 591a3da26..66c3916b2 100644 --- a/tar/write.c +++ b/tar/write.c @@ -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); -- 2.47.3