Skip to content

Commit f56c785

Browse files
tchardingaerusso
authored andcommitted
Use bitwise '&' instead of logical '&&'
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
1 parent ffcce77 commit f56c785

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

cmd/zed/zed_conf.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -394,13 +394,13 @@ zed_conf_scan_dir(struct zed_conf *zcp)
394394
direntp->d_name);
395395
continue;
396396
}
397-
if ((st.st_mode & S_IWGRP) & !zcp->do_force) {
397+
if ((st.st_mode & S_IWGRP) && !zcp->do_force) {
398398
zed_log_msg(LOG_NOTICE,
399399
"Ignoring \"%s\": writable by group",
400400
direntp->d_name);
401401
continue;
402402
}
403-
if ((st.st_mode & S_IWOTH) & !zcp->do_force) {
403+
if ((st.st_mode & S_IWOTH) && !zcp->do_force) {
404404
zed_log_msg(LOG_NOTICE,
405405
"Ignoring \"%s\": writable by other",
406406
direntp->d_name);

0 commit comments

Comments
 (0)