mirror of
https://git.FreeBSD.org/src.git
synced 2025-01-20 15:43:16 +00:00
If lstat(2) fails, have bsdtar return a non-zero exit code if the
failed path is one which was specified on the command line. This is a compromise between the situation prior to revision 1.57 (where a race between tar(1) and rm(1) could cause tar(1) to spuriously report an error) and the situation after revision 1.57 (where "tar -c /no/such/path" prints a warning but returns with an exit code of zero). Inspired by: rafan MFC after: 1 week
This commit is contained in:
parent
9310f22692
commit
c85ac10468
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=169226
@ -649,6 +649,16 @@ write_hierarchy(struct bsdtar *bsdtar, struct archive *a, const char *path)
|
||||
if (lst == NULL) {
|
||||
/* Couldn't lstat(); must not exist. */
|
||||
bsdtar_warnc(bsdtar, errno, "%s: Cannot stat", name);
|
||||
|
||||
/*
|
||||
* Report an error via the exit code if the failed
|
||||
* path is a prefix of what the user provided via
|
||||
* the command line. (Testing for string equality
|
||||
* here won't work due to trailing '/' characters.)
|
||||
*/
|
||||
if (memcmp(name, path, strlen(name)) == 0)
|
||||
bsdtar->return_value = 1;
|
||||
|
||||
continue;
|
||||
}
|
||||
if (S_ISLNK(lst->st_mode))
|
||||
|
Loading…
Reference in New Issue
Block a user