X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=src%2Fincremen.c;h=c68a88b48e83389359b57eb3cbbccefb19b0a3a9;hb=8e3f3adf9888cca4acedfe005d277867c999fcb3;hp=7f04f80b457eff53cbbdd2d6bda67a60920fa0e2;hpb=05805868f26533141b8b02d5a6449965652ef187;p=chaz%2Ftar diff --git a/src/incremen.c b/src/incremen.c index 7f04f80..c68a88b 100644 --- a/src/incremen.c +++ b/src/incremen.c @@ -20,6 +20,7 @@ #include #include #include +#include #include #include "common.h" @@ -378,7 +379,9 @@ dumpdir_size (const char *p) static int compare_dirnames (const void *first, const void *second) { - return strcmp (*(const char**)first, *(const char**)second); + char const *const *name1 = first; + char const *const *name2 = second; + return strcmp (*name1, *name2); } /* Compare dumpdir array from DIRECTORY with directory listing DIR and @@ -1381,22 +1384,23 @@ try_purge_directory (char const *directory_name) free (p); p = new_name (directory_name, cur); - if (!(entry = dumpdir_locate (current_stat_info.dumpdir, cur)) - || (*entry == 'D' && S_ISDIR (st.st_mode)) - || (*entry == 'Y' && !S_ISDIR (st.st_mode))) + if (deref_stat (false, p, &st)) { - if (deref_stat (false, p, &st)) + if (errno != ENOENT) /* FIXME: Maybe keep a list of renamed + dirs and check it here? */ { - if (errno != ENOENT) /* FIXME: Maybe keep a list of renamed - dirs and check it here? */ - { - stat_diag (p); - WARN ((0, 0, _("%s: Not purging directory: unable to stat"), - quotearg_colon (p))); - } - continue; + stat_diag (p); + WARN ((0, 0, _("%s: Not purging directory: unable to stat"), + quotearg_colon (p))); } - else if (one_file_system_option && st.st_dev != root_device) + continue; + } + + if (!(entry = dumpdir_locate (current_stat_info.dumpdir, cur)) + || (*entry == 'D' && !S_ISDIR (st.st_mode)) + || (*entry == 'Y' && S_ISDIR (st.st_mode))) + { + if (one_file_system_option && st.st_dev != root_device) { WARN ((0, 0, _("%s: directory is on a different device: not purging"),