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

LVM2.2.02.179/lib/metadata/metadata.c: confused logic ? #7

Closed
dcb314 opened this issue Jun 20, 2018 · 1 comment
Closed

LVM2.2.02.179/lib/metadata/metadata.c: confused logic ? #7

dcb314 opened this issue Jun 20, 2018 · 1 comment

Comments

@dcb314
Copy link

dcb314 commented Jun 20, 2018

LVM2.2.02.179/lib/metadata/metadata.c:4125] -> [LVM2.2.02.179/lib/metadata/metadata.c:4179]: (warning) Identical inner 'if' condition is always true.

Line 4125 is

 if (!correct_vg) {

and line 4179 is

             if (!correct_vg) {
                            correct_vg = vg;
                            if (!_update_pv_list(cmd->mem, &all_pvs, correct_vg)) {
                                    _free_pv_list(&all_pvs);
                                    fid->ref_count--;
                                    release_vg(vg);
                                    return_NULL;
                            }
                            continue;
                    }

which means that the continue always executes and so the rest of the code
in the block can never execute. Looks suspicious to me.

@zkabelac
Copy link
Contributor

zkabelac commented Feb 1, 2019

I guess - the loop is processing the list of metadata - and the first metadata goes through here - is marked 'correct_vg' - continue then means to go and get the 'next' metadata set.
Next iteration will have 'correct_vg !=NULL' so it will skip this if().

@zkabelac zkabelac closed this as completed Feb 1, 2019
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