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

Unreachable code in storage/drivers/overlay/overlay.go #1900

Open
eriksjolund opened this issue Apr 22, 2024 · 1 comment
Open

Unreachable code in storage/drivers/overlay/overlay.go #1900

eriksjolund opened this issue Apr 22, 2024 · 1 comment

Comments

@eriksjolund
Copy link
Contributor

eriksjolund commented Apr 22, 2024

Could this if statement be removed?

if err == nil && !permsKnown {
perms = os.FileMode(st.Mode())
permsKnown = true
}

It seems that permsKnown already needs to be true, because otherwise the for loop would have been skipped.

Here is the relevant code:

if err == nil {
perms = os.FileMode(st.Mode())
permsKnown = true
}
for err == nil {
absLowers = append(absLowers, filepath.Join(dir, nameWithSuffix("diff", diffN)))
diffN++
st, err = os.Stat(filepath.Join(dir, nameWithSuffix("diff", diffN)))
if err == nil && !permsKnown {
perms = os.FileMode(st.Mode())
permsKnown = true
}
}

The code originates from the PR

@rhatdan
Copy link
Member

rhatdan commented Apr 23, 2024

@giuseppe @mtrmac PTAL

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants