mirror of
https://git.savannah.gnu.org/git/tar.git
synced 2026-04-21 09:00:38 +00:00
Warn about existing files in keep-old-files mode (complements 8f390db9).
This is controlled by "existing-file" warning code, which is off by default. * src/common.h (WARN_EXISTING_FILE): New warning code. (WARN_VERBOSE_WARNINGS): Add WARN_EXISTING_FILE. * src/extract.c (maybe_recoverable): warn about existing file if WARN_EXISTING_FILE is set. * src/warning.c: New warning type: "existing-file"
This commit is contained in:
@@ -810,11 +810,12 @@ void checkpoint_run (bool do_write);
|
||||
#define WARN_UNKNOWN_KEYWORD 0x00020000
|
||||
#define WARN_XDEV 0x00040000
|
||||
#define WARN_DECOMPRESS_PROGRAM 0x00080000
|
||||
#define WARN_EXISTING_FILE 0x00100000
|
||||
|
||||
/* The warnings composing WARN_VERBOSE_WARNINGS are enabled by default
|
||||
in verbose mode */
|
||||
#define WARN_VERBOSE_WARNINGS (WARN_RENAME_DIRECTORY|WARN_NEW_DIRECTORY|\
|
||||
WARN_DECOMPRESS_PROGRAM)
|
||||
WARN_DECOMPRESS_PROGRAM|WARN_EXISTING_FILE)
|
||||
#define WARN_ALL (~WARN_VERBOSE_WARNINGS)
|
||||
|
||||
void set_warning_option (const char *arg);
|
||||
|
||||
@@ -643,6 +643,8 @@ maybe_recoverable (char *file_name, bool regular, bool *interdir_made)
|
||||
switch (old_files_option)
|
||||
{
|
||||
case KEEP_OLD_FILES:
|
||||
WARNOPT (WARN_EXISTING_FILE,
|
||||
(0, 0, _("%s: skipping existing file"), file_name));
|
||||
return RECOVER_SKIP;
|
||||
|
||||
case KEEP_NEWER_FILES:
|
||||
|
||||
@@ -42,6 +42,7 @@ static char const *const warning_args[] = {
|
||||
"unknown-keyword",
|
||||
"xdev",
|
||||
"decompress-program",
|
||||
"existing-file",
|
||||
NULL
|
||||
};
|
||||
|
||||
@@ -66,7 +67,8 @@ static int warning_types[] = {
|
||||
WARN_UNKNOWN_CAST,
|
||||
WARN_UNKNOWN_KEYWORD,
|
||||
WARN_XDEV,
|
||||
WARN_DECOMPRESS_PROGRAM
|
||||
WARN_DECOMPRESS_PROGRAM,
|
||||
WARN_EXISTING_FILE
|
||||
};
|
||||
|
||||
ARGMATCH_VERIFY (warning_args, warning_types);
|
||||
|
||||
Reference in New Issue
Block a user