If opendir(".") fails after descending into a subdirectory via
chdir(), be sure to undo the effects of the chdir before continuing. Without this, after hitting a directory with mode 0111 (for example), tar will get lost, and won't add any yet unvisted files to your archive. (Or possibly add the wrong files, I suppose...) Reviewed By: kientzle@
This commit is contained in:
parent
91387563e2
commit
d12dff713a
@ -311,13 +311,14 @@ tree_next(struct tree *t)
|
||||
t->tree_errno = errno;
|
||||
return (t->visit_type = TREE_ERROR_DIR);
|
||||
}
|
||||
t->depth++;
|
||||
t->d = opendir(".");
|
||||
if (t->d == NULL) {
|
||||
tree_ascend(t); /* Undo "chdir" */
|
||||
tree_pop(t);
|
||||
t->tree_errno = errno;
|
||||
return (t->visit_type = TREE_ERROR_DIR);
|
||||
}
|
||||
t->depth++;
|
||||
t->flags &= ~hasLstat;
|
||||
t->flags &= ~hasStat;
|
||||
t->basename = ".";
|
||||
|
Loading…
x
Reference in New Issue
Block a user