mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
archiving: update refactoring
Commit 5ea426e656
handled case with
file path without '/' incorrectly - there is valid use-case so
switch 'log_error()' to valid code branch.
This commit is contained in:
parent
c38473548e
commit
7e346ee2a5
@ -373,21 +373,21 @@ int archive_list_file(struct cmd_context *cmd, const char *file)
|
||||
}
|
||||
|
||||
if (!(af.name = strrchr(file, '/'))) {
|
||||
log_error("No '/' in file path %s found.", file);
|
||||
return 0;
|
||||
af.name = file;
|
||||
path[0] = 0;
|
||||
} else {
|
||||
len = (size_t)(af.name - file);
|
||||
|
||||
if (len >= sizeof(path)) {
|
||||
log_error(INTERNAL_ERROR "Passed file path name %s is too long.", file);
|
||||
return 0;
|
||||
}
|
||||
|
||||
memcpy(path, file, len);
|
||||
path[len] = 0;
|
||||
af.name++; /* jump over '/' */
|
||||
}
|
||||
|
||||
len = (size_t)(af.name - file);
|
||||
|
||||
if (len >= sizeof(path)) {
|
||||
log_error(INTERNAL_ERROR "Passed file path name %s is too long.", file);
|
||||
return 0;
|
||||
}
|
||||
|
||||
memcpy(path, file, len);
|
||||
path[len] = 0;
|
||||
af.name++; /* jump over '/' */
|
||||
|
||||
_display_archive(cmd, path, &af);
|
||||
|
||||
return 1;
|
||||
|
Loading…
Reference in New Issue
Block a user