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

zfs-0.7.2/cmd/zed/zed_conf.c: 2 * possible wrong operator ? #6684

Closed
dcb314 opened this issue Sep 26, 2017 · 0 comments · Fixed by #6722
Closed

zfs-0.7.2/cmd/zed/zed_conf.c: 2 * possible wrong operator ? #6684

dcb314 opened this issue Sep 26, 2017 · 0 comments · Fixed by #6722
Labels
good first issue Indicates a good issue for first-time contributors

Comments

@dcb314
Copy link

dcb314 commented Sep 26, 2017

zfs-0.7.2/cmd/zed/zed_conf.c:397]: (style) Boolean result is used in bitwise operation. Clarify expression with parentheses.
[zfs-0.7.2/cmd/zed/zed_conf.c:403]: (style) Boolean result is used in bitwise operation. Clarify expression with parentheses.

Source code is

    if ((st.st_mode & S_IWGRP) & !zcp->do_force) {

Maybe better code

    if ((st.st_mode & S_IWGRP) && !zcp->do_force) {

SImilar a few lines further down.

@behlendorf behlendorf added the good first issue Indicates a good issue for first-time contributors label Sep 26, 2017
behlendorf pushed a commit that referenced this issue Oct 6, 2017
Make two instances of the same change. Change bitwise AND (&) to logical
AND (&&).

Currently the code uses a bitwise AND between two boolean values.

In the first instance;

The first operand is a flag that has been bitwise combined with a bit
mask to get a boolean value as to whether a file has group write
permissions set.

The second operand used is a struct member that is intended as a
boolean flag not a bit mask.

In the second instance the argument is the same except with world write
permissions instead of group write (S_IWOTH, S_IWGRP).

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: George Melikov <mail@gmelikov.ru>
Reviewed-by: Chris Dunlop <chris@onthe.net.au>
Signed-off-by: Tobin C. Harding <me@tobin.cc>
Closes #6684 
Closes #6722
aerusso pushed a commit to aerusso/zfs that referenced this issue Oct 11, 2017
Make two instances of the same change. Change bitwise AND (&) to logical
AND (&&).

Currently the code uses a bitwise AND between two boolean values.

In the first instance;

The first operand is a flag that has been bitwise combined with a bit
mask to get a boolean value as to whether a file has group write
permissions set.

The second operand used is a struct member that is intended as a
boolean flag not a bit mask.

In the second instance the argument is the same except with world write
permissions instead of group write (S_IWOTH, S_IWGRP).

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: George Melikov <mail@gmelikov.ru>
Reviewed-by: Chris Dunlop <chris@onthe.net.au>
Signed-off-by: Tobin C. Harding <me@tobin.cc>
Closes openzfs#6684 
Closes openzfs#6722
tonyhutter pushed a commit that referenced this issue Oct 16, 2017
Make two instances of the same change. Change bitwise AND (&) to logical
AND (&&).

Currently the code uses a bitwise AND between two boolean values.

In the first instance;

The first operand is a flag that has been bitwise combined with a bit
mask to get a boolean value as to whether a file has group write
permissions set.

The second operand used is a struct member that is intended as a
boolean flag not a bit mask.

In the second instance the argument is the same except with world write
permissions instead of group write (S_IWOTH, S_IWGRP).

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: George Melikov <mail@gmelikov.ru>
Reviewed-by: Chris Dunlop <chris@onthe.net.au>
Signed-off-by: Tobin C. Harding <me@tobin.cc>
Closes #6684
Closes #6722
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Indicates a good issue for first-time contributors
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants