If you see a broken symlink, don't try to follow it,
just archive it as a symlink, even if -h was specified. Thanks to: Jin Guojun PR: bin/95175 MFC After: 1 week
This commit is contained in:
parent
9c6a71e4ca
commit
b8c95d3fe1
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=157395
@ -1,7 +1,7 @@
|
||||
# $FreeBSD$
|
||||
|
||||
PROG= bsdtar
|
||||
VERSION= 1.2.51
|
||||
VERSION= 1.2.53
|
||||
SRCS= bsdtar.c getdate.y matching.c read.c tree.c util.c write.c
|
||||
WARNS?= 5
|
||||
DPADD= ${LIBARCHIVE} ${LIBBZ2} ${LIBZ}
|
||||
|
@ -629,15 +629,18 @@ write_hierarchy(struct bsdtar *bsdtar, struct archive *a, const char *path)
|
||||
*/
|
||||
switch(symlink_mode) {
|
||||
case 'H':
|
||||
/* 'H': First item (from command line) like 'L'. */
|
||||
lst = tree_current_stat(tree);
|
||||
/* 'H': After the first item, rest like 'P'. */
|
||||
symlink_mode = 'P';
|
||||
break;
|
||||
/* 'H': First item (from command line) like 'L'. */
|
||||
/* FALLTHROUGH */
|
||||
case 'L':
|
||||
/* 'L': Do descend through a symlink to dir. */
|
||||
/* 'L': Archive symlink to file as file. */
|
||||
lst = tree_current_stat(tree);
|
||||
/* If stat fails, we have a broken symlink;
|
||||
* in that case, archive the link as such. */
|
||||
if (lst == NULL)
|
||||
lst = tree_current_lstat(tree);
|
||||
break;
|
||||
default:
|
||||
/* 'P': Don't descend through a symlink to dir. */
|
||||
|
Loading…
Reference in New Issue
Block a user