Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mac ProjFS: shadowed variable bugfixes #1483

Merged
merged 2 commits into from
Aug 24, 2019

Conversation

pmj
Copy link
Contributor

@pmj pmj commented Aug 23, 2019

While scouring the PrjFSLib code for file I/O calls that might follow symlinks, I discovered that we were potentially leaking open directory handles and returning incorrect error codes in HandleRecursivelyEnumerateDirectoryRequest() and RecursivelyMarkAllChildrenAsInRoot() due to erroneously re-declared/shadowed variables.

The first commit fixes those errors.

The second commit turns on the compiler warning about shadowed variables. This uncovered a number of other instances of shadowed variables; fortunately these turned out to be largely benign, or in the case of the unit tests, pointed to unnecessary code. All the flagged instances are also fixed in this commit.

Variables were re-declared instead of simply assigned, potentially causing resource leaks and incorrect return codes on error control flow paths.
To avoid bugs resulting from shadowed variables in future, the corresponding compiler warning is now turned on across the entire project. A few benign instances discovered by the setting are resolved as well.
@pmj pmj changed the title Mac projfs shadowed variable bugfixes Mac ProjFS: shadowed variable bugfixes Aug 23, 2019
@pmj pmj marked this pull request as ready for review August 23, 2019 13:58
@pmj pmj requested review from wilbaker and jeschu1 August 23, 2019 13:58
Copy link
Member

@wilbaker wilbaker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Glad you uncovered this! Fix looks good.

@pmj pmj merged commit 993b69d into microsoft:master Aug 24, 2019
@pmj pmj deleted the mac-projfs-shadowed-variable-bugfixes branch August 24, 2019 14:55
@alameenshah alameenshah added this to the M159 milestone Sep 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants