| @@ -638,27 +638,27 @@ copy_file_data(struct bsdtar *bsdtar, st | | | @@ -638,27 +638,27 @@ copy_file_data(struct bsdtar *bsdtar, st |
638 | } | | 638 | } |
639 | | | 639 | |
640 | /* | | 640 | /* |
641 | * Add the file or dir hierarchy named by 'path' to the archive | | 641 | * Add the file or dir hierarchy named by 'path' to the archive |
642 | */ | | 642 | */ |
643 | static void | | 643 | static void |
644 | write_hierarchy(struct bsdtar *bsdtar, struct archive *a, const char *path) | | 644 | write_hierarchy(struct bsdtar *bsdtar, struct archive *a, const char *path) |
645 | { | | 645 | { |
646 | struct tree *tree; | | 646 | struct tree *tree; |
647 | char symlink_mode = bsdtar->symlink_mode; | | 647 | char symlink_mode = bsdtar->symlink_mode; |
648 | dev_t first_dev = 0; | | 648 | dev_t first_dev = 0; |
649 | int dev_recorded = 0; | | 649 | int dev_recorded = 0; |
650 | int tree_ret; | | 650 | int tree_ret; |
651 | #ifdef __linux | | 651 | #ifdef HAVE_EXT2FS_EXT2_FS_H |
652 | int fd, r; | | 652 | int fd, r; |
653 | unsigned long fflags; | | 653 | unsigned long fflags; |
654 | #endif | | 654 | #endif |
655 | | | 655 | |
656 | tree = tree_open(path); | | 656 | tree = tree_open(path); |
657 | | | 657 | |
658 | if (!tree) { | | 658 | if (!tree) { |
659 | bsdtar_warnc(bsdtar, errno, "%s: Cannot open", path); | | 659 | bsdtar_warnc(bsdtar, errno, "%s: Cannot open", path); |
660 | bsdtar->return_value = 1; | | 660 | bsdtar->return_value = 1; |
661 | return; | | 661 | return; |
662 | } | | 662 | } |
663 | | | 663 | |
664 | while ((tree_ret = tree_next(tree))) { | | 664 | while ((tree_ret = tree_next(tree))) { |
| @@ -710,27 +710,27 @@ write_hierarchy(struct bsdtar *bsdtar, s | | | @@ -710,27 +710,27 @@ write_hierarchy(struct bsdtar *bsdtar, s |
710 | descend = 0; | | 710 | descend = 0; |
711 | } | | 711 | } |
712 | | | 712 | |
713 | /* | | 713 | /* |
714 | * If this file/dir is flagged "nodump" and we're | | 714 | * If this file/dir is flagged "nodump" and we're |
715 | * honoring such flags, skip this file/dir. | | 715 | * honoring such flags, skip this file/dir. |
716 | */ | | 716 | */ |
717 | #ifdef HAVE_CHFLAGS | | 717 | #ifdef HAVE_CHFLAGS |
718 | if (bsdtar->option_honor_nodump && | | 718 | if (bsdtar->option_honor_nodump && |
719 | (lst->st_flags & UF_NODUMP)) | | 719 | (lst->st_flags & UF_NODUMP)) |
720 | continue; | | 720 | continue; |
721 | #endif | | 721 | #endif |
722 | | | 722 | |
723 | #ifdef __linux | | 723 | #ifdef HAVE_EXT2FS_EXT2_FS_H |
724 | /* | | 724 | /* |
725 | * Linux has a nodump flag too but to read it | | 725 | * Linux has a nodump flag too but to read it |
726 | * we have to open() the file/dir and do an ioctl on it... | | 726 | * we have to open() the file/dir and do an ioctl on it... |
727 | */ | | 727 | */ |
728 | if (bsdtar->option_honor_nodump && | | 728 | if (bsdtar->option_honor_nodump && |
729 | ((fd = open(name, O_RDONLY|O_NONBLOCK)) >= 0) && | | 729 | ((fd = open(name, O_RDONLY|O_NONBLOCK)) >= 0) && |
730 | ((r = ioctl(fd, EXT2_IOC_GETFLAGS, &fflags)), | | 730 | ((r = ioctl(fd, EXT2_IOC_GETFLAGS, &fflags)), |
731 | close(fd), r) >= 0 && | | 731 | close(fd), r) >= 0 && |
732 | (fflags & EXT2_NODUMP_FL)) | | 732 | (fflags & EXT2_NODUMP_FL)) |
733 | continue; | | 733 | continue; |
734 | #endif | | 734 | #endif |
735 | | | 735 | |
736 | /* | | 736 | /* |
| @@ -840,27 +840,27 @@ write_entry_backend(struct bsdtar *bsdta | | | @@ -840,27 +840,27 @@ write_entry_backend(struct bsdtar *bsdta |
840 | close(fd); | | 840 | close(fd); |
841 | } | | 841 | } |
842 | } | | 842 | } |
843 | | | 843 | |
844 | /* | | 844 | /* |
845 | * Add a single filesystem object to the archive. | | 845 | * Add a single filesystem object to the archive. |
846 | */ | | 846 | */ |
847 | static void | | 847 | static void |
848 | write_entry(struct bsdtar *bsdtar, struct archive *a, const struct stat *st, | | 848 | write_entry(struct bsdtar *bsdtar, struct archive *a, const struct stat *st, |
849 | const char *pathname, const char *accpath) | | 849 | const char *pathname, const char *accpath) |
850 | { | | 850 | { |
851 | struct archive_entry *entry, *sparse_entry; | | 851 | struct archive_entry *entry, *sparse_entry; |
852 | int fd; | | 852 | int fd; |
853 | #ifdef __linux | | 853 | #ifdef HAVE_EXT2FS_EXT2_FS_H |
854 | int r; | | 854 | int r; |
855 | unsigned long stflags; | | 855 | unsigned long stflags; |
856 | #endif | | 856 | #endif |
857 | static char linkbuffer[PATH_MAX+1]; | | 857 | static char linkbuffer[PATH_MAX+1]; |
858 | | | 858 | |
859 | fd = -1; | | 859 | fd = -1; |
860 | entry = archive_entry_new(); | | 860 | entry = archive_entry_new(); |
861 | | | 861 | |
862 | archive_entry_set_pathname(entry, pathname); | | 862 | archive_entry_set_pathname(entry, pathname); |
863 | archive_entry_copy_sourcepath(entry, accpath); | | 863 | archive_entry_copy_sourcepath(entry, accpath); |
864 | | | 864 | |
865 | /* | | 865 | /* |
866 | * Rewrite the pathname to be archived. If rewrite | | 866 | * Rewrite the pathname to be archived. If rewrite |
| @@ -899,27 +899,27 @@ write_entry(struct bsdtar *bsdtar, struc | | | @@ -899,27 +899,27 @@ write_entry(struct bsdtar *bsdtar, struc |
899 | linkbuffer[lnklen] = 0; | | 899 | linkbuffer[lnklen] = 0; |
900 | archive_entry_set_symlink(entry, linkbuffer); | | 900 | archive_entry_set_symlink(entry, linkbuffer); |
901 | } | | 901 | } |
902 | | | 902 | |
903 | /* Look up username and group name. */ | | 903 | /* Look up username and group name. */ |
904 | archive_entry_set_uname(entry, lookup_uname(bsdtar, st->st_uid)); | | 904 | archive_entry_set_uname(entry, lookup_uname(bsdtar, st->st_uid)); |
905 | archive_entry_set_gname(entry, lookup_gname(bsdtar, st->st_gid)); | | 905 | archive_entry_set_gname(entry, lookup_gname(bsdtar, st->st_gid)); |
906 | | | 906 | |
907 | #ifdef HAVE_CHFLAGS | | 907 | #ifdef HAVE_CHFLAGS |
908 | if (st->st_flags != 0) | | 908 | if (st->st_flags != 0) |
909 | archive_entry_set_fflags(entry, st->st_flags, 0); | | 909 | archive_entry_set_fflags(entry, st->st_flags, 0); |
910 | #endif | | 910 | #endif |
911 | | | 911 | |
912 | #ifdef __linux | | 912 | #ifdef HAVE_EXT2FS_EXT2_FS_H |
913 | if ((S_ISREG(st->st_mode) || S_ISDIR(st->st_mode)) && | | 913 | if ((S_ISREG(st->st_mode) || S_ISDIR(st->st_mode)) && |
914 | ((fd = open(accpath, O_RDONLY|O_NONBLOCK)) >= 0) && | | 914 | ((fd = open(accpath, O_RDONLY|O_NONBLOCK)) >= 0) && |
915 | ((r = ioctl(fd, EXT2_IOC_GETFLAGS, &stflags)), close(fd), (fd = -1), r) >= 0 && | | 915 | ((r = ioctl(fd, EXT2_IOC_GETFLAGS, &stflags)), close(fd), (fd = -1), r) >= 0 && |
916 | stflags) { | | 916 | stflags) { |
917 | archive_entry_set_fflags(entry, stflags, 0); | | 917 | archive_entry_set_fflags(entry, stflags, 0); |
918 | } | | 918 | } |
919 | #endif | | 919 | #endif |
920 | | | 920 | |
921 | archive_entry_copy_stat(entry, st); | | 921 | archive_entry_copy_stat(entry, st); |
922 | setup_acls(bsdtar, entry, accpath); | | 922 | setup_acls(bsdtar, entry, accpath); |
923 | setup_xattrs(bsdtar, entry, accpath); | | 923 | setup_xattrs(bsdtar, entry, accpath); |
924 | | | 924 | |
925 | /* Non-regular files get archived with zero size. */ | | 925 | /* Non-regular files get archived with zero size. */ |