Skip to content

Commit

Permalink
Handle missing root in OverlayFS
Browse files Browse the repository at this point in the history
Fix infinite async recursion in this case
  • Loading branch information
1j01 committed May 18, 2018
1 parent 79ca5fd commit 850c9db
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/backend/OverlayFS.ts
Original file line number Diff line number Diff line change
Expand Up @@ -854,9 +854,13 @@ export class UnlockedOverlayFS extends BaseFileSystem implements FileSystem {
this._writable.stat(parent, false, statDone);
function statDone(err: ApiError, stat?: Stats): void {
if (err) {
toCreate.push(parent);
parent = path.dirname(parent);
self._writable.stat(parent, false, statDone);
if (parent === "/") {
cb(new ApiError(ErrorCode.EBUSY, "Invariant failed: root does not exist!"));
} else {
toCreate.push(parent);
parent = path.dirname(parent);
self._writable.stat(parent, false, statDone);
}
} else {
createParents();
}
Expand Down

0 comments on commit 850c9db

Please sign in to comment.