| 722 | Return true if successful. */ |
| 723 | |
| 724 | static bool |
| 725 | du_files (char **files, int bit_flags) |
| 726 | { |
| 727 | bool ok = true; |
| 728 | |
| 729 | if (*files) |
| 730 | { |
| 731 | FTS *fts = xfts_open (files, bit_flags, NULL); |
| 732 | |
| 733 | while (true) |
| 734 | { |
| 735 | FTSENT *ent; |
| 736 | |
| 737 | ent = fts_read (fts); |
| 738 | if (ent == NULL) |
| 739 | { |
| 740 | if (errno != 0) |
| 741 | { |
| 742 | error (0, errno, _("fts_read failed: %s"), |
| 743 | quotef (fts->fts_path)); |
| 744 | ok = false; |
| 745 | } |
| 746 | |
| 747 | /* When exiting this loop early, be careful to reset the |
| 748 | global, prev_level, used in process_file. Otherwise, its |
| 749 | (level == prev_level - 1) assertion could fail. */ |
| 750 | prev_level = 0; |
| 751 | break; |
| 752 | } |
| 753 | |
| 754 | #if GNULIB_FTS_DEBUG |
| 755 | if (fts_debug) |
| 756 | fts_cross_check (fts); |
| 757 | #endif |
| 758 | |
| 759 | ok &= process_file (fts, ent); |
| 760 | } |
| 761 | |
| 762 | if (fts_close (fts) != 0) |
| 763 | { |
| 764 | error (0, errno, _("fts_close failed")); |
| 765 | ok = false; |
| 766 | } |
| 767 | } |
| 768 | |
| 769 | return ok; |
| 770 | } |
| 771 | |
| 772 | int |
| 773 | main (int argc, char **argv) |
no test coverage detected