mirror of
https://git.savannah.gnu.org/git/tar.git
synced 2026-09-01 05:37:17 +00:00
New option --warning=failed-read
* NEWS: Document the --warning=failed-read option. * doc/tar.texi: Likewise. * doc/tar.1: Likewise. * src/common.h (WARN_FAILED_READ): New constant. (WARNING_ENABLED): New macro. * src/misc.c (close_diag, open_diag) (read_diag_details, readlink_diag) (savedir_diag, seek_diag_details) (stat_diag): Suppress warnings if WARN_FAILED_READ is set. * src/warning.c (failed-read): New keyword.
This commit is contained in:
+4
-1
@@ -927,6 +927,7 @@ void checkpoint_flush_actions (void);
|
||||
#define WARN_EXISTING_FILE 0x00100000
|
||||
#define WARN_XATTR_WRITE 0x00200000
|
||||
#define WARN_RECORD_SIZE 0x00400000
|
||||
#define WARN_FAILED_READ 0x00800000
|
||||
|
||||
/* These warnings are enabled by default in verbose mode: */
|
||||
#define WARN_VERBOSE_WARNINGS (WARN_RENAME_DIRECTORY|WARN_NEW_DIRECTORY|\
|
||||
@@ -938,10 +939,12 @@ void set_warning_option (const char *arg);
|
||||
|
||||
extern int warning_option;
|
||||
|
||||
#define WARNING_ENABLED(opt) (warning_option & (opt))
|
||||
|
||||
#define WARNOPT(opt,args) \
|
||||
do \
|
||||
{ \
|
||||
if (warning_option & opt) WARN (args); \
|
||||
if (WARNING_ENABLED(opt)) WARN (args); \
|
||||
} \
|
||||
while (0)
|
||||
|
||||
|
||||
+28
-7
@@ -1044,7 +1044,10 @@ void
|
||||
close_diag (char const *name)
|
||||
{
|
||||
if (ignore_failed_read_option)
|
||||
close_warn (name);
|
||||
{
|
||||
if (WARNING_ENABLED(WARN_FAILED_READ))
|
||||
close_warn (name);
|
||||
}
|
||||
else
|
||||
close_error (name);
|
||||
}
|
||||
@@ -1053,7 +1056,10 @@ void
|
||||
open_diag (char const *name)
|
||||
{
|
||||
if (ignore_failed_read_option)
|
||||
open_warn (name);
|
||||
{
|
||||
if (WARNING_ENABLED(WARN_FAILED_READ))
|
||||
open_warn (name);
|
||||
}
|
||||
else
|
||||
open_error (name);
|
||||
}
|
||||
@@ -1062,7 +1068,10 @@ void
|
||||
read_diag_details (char const *name, off_t offset, size_t size)
|
||||
{
|
||||
if (ignore_failed_read_option)
|
||||
read_warn_details (name, offset, size);
|
||||
{
|
||||
if (WARNING_ENABLED(WARN_FAILED_READ))
|
||||
read_warn_details (name, offset, size);
|
||||
}
|
||||
else
|
||||
read_error_details (name, offset, size);
|
||||
}
|
||||
@@ -1071,7 +1080,10 @@ void
|
||||
readlink_diag (char const *name)
|
||||
{
|
||||
if (ignore_failed_read_option)
|
||||
readlink_warn (name);
|
||||
{
|
||||
if (WARNING_ENABLED(WARN_FAILED_READ))
|
||||
readlink_warn (name);
|
||||
}
|
||||
else
|
||||
readlink_error (name);
|
||||
}
|
||||
@@ -1080,7 +1092,10 @@ void
|
||||
savedir_diag (char const *name)
|
||||
{
|
||||
if (ignore_failed_read_option)
|
||||
savedir_warn (name);
|
||||
{
|
||||
if (WARNING_ENABLED(WARN_FAILED_READ))
|
||||
savedir_warn (name);
|
||||
}
|
||||
else
|
||||
savedir_error (name);
|
||||
}
|
||||
@@ -1089,7 +1104,10 @@ void
|
||||
seek_diag_details (char const *name, off_t offset)
|
||||
{
|
||||
if (ignore_failed_read_option)
|
||||
seek_warn_details (name, offset);
|
||||
{
|
||||
if (WARNING_ENABLED(WARN_FAILED_READ))
|
||||
seek_warn_details (name, offset);
|
||||
}
|
||||
else
|
||||
seek_error_details (name, offset);
|
||||
}
|
||||
@@ -1098,7 +1116,10 @@ void
|
||||
stat_diag (char const *name)
|
||||
{
|
||||
if (ignore_failed_read_option)
|
||||
stat_warn (name);
|
||||
{
|
||||
if (WARNING_ENABLED(WARN_FAILED_READ))
|
||||
stat_warn (name);
|
||||
}
|
||||
else
|
||||
stat_error (name);
|
||||
}
|
||||
|
||||
+3
-1
@@ -47,6 +47,7 @@ static char const *const warning_args[] = {
|
||||
"existing-file",
|
||||
"xattr-write",
|
||||
"record-size",
|
||||
"failed-read",
|
||||
NULL
|
||||
};
|
||||
|
||||
@@ -74,7 +75,8 @@ static int warning_types[] = {
|
||||
WARN_DECOMPRESS_PROGRAM,
|
||||
WARN_EXISTING_FILE,
|
||||
WARN_XATTR_WRITE,
|
||||
WARN_RECORD_SIZE
|
||||
WARN_RECORD_SIZE,
|
||||
WARN_FAILED_READ
|
||||
};
|
||||
|
||||
ARGMATCH_VERIFY (warning_args, warning_types);
|
||||
|
||||
Reference in New Issue
Block a user