X-Git-Url: https://git.brokenzipper.com/gitweb?a=blobdiff_plain;f=src%2Fmisc.c;h=3a23aa4d2fd0664b6b9680f3151484484671c867;hb=006c1efbe8ab3cbc335e8d22971ae4496577294c;hp=a76b24eb6764cc85106c8bc38fbfa94f446f76f0;hpb=2b1bffbad66faab91c3b080b63788d910f68632d;p=chaz%2Ftar diff --git a/src/misc.c b/src/misc.c index a76b24e..3a23aa4 100644 --- a/src/misc.c +++ b/src/misc.c @@ -745,6 +745,38 @@ stat_diag (char const *name) stat_error (name); } +void +file_removed_diag (const char *name, bool top_level, + void (*diagfn) (char const *name)) +{ + if (!top_level && errno == ENOENT) + { + WARNOPT (WARN_FILE_REMOVED, + (0, 0, _("%s: File removed before we read it"), + quotearg_colon (name))); + if (exit_status == TAREXIT_SUCCESS) + exit_status = TAREXIT_DIFFERS; + } + else + diagfn (name); +} + +void +dir_removed_diag (const char *name, bool top_level, + void (*diagfn) (char const *name)) +{ + if (!top_level && errno == ENOENT) + { + WARNOPT (WARN_FILE_REMOVED, + (0, 0, _("%s: Directory removed before we read it"), + quotearg_colon (name))); + if (exit_status == TAREXIT_SUCCESS) + exit_status = TAREXIT_DIFFERS; + } + else + diagfn (name); +} + void write_fatal_details (char const *name, ssize_t status, size_t size) {