]> granicus.if.org Git - zfs/commitdiff
Use bitwise '&' instead of logical '&&'
authorTobin Harding <me@tobin.cc>
Fri, 6 Oct 2017 02:38:55 +0000 (13:38 +1100)
committerTony Hutter <hutter2@llnl.gov>
Mon, 16 Oct 2017 17:57:55 +0000 (10:57 -0700)
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

cmd/zed/zed_conf.c

index a79fe862d97a9c144d5b8a065a992fbe157780e6..5b27f1e4f1f248531f7af9b5113577da6fc38e9e 100644 (file)
@@ -394,13 +394,13 @@ zed_conf_scan_dir(struct zed_conf *zcp)
                            direntp->d_name);
                        continue;
                }
-               if ((st.st_mode & S_IWGRP) & !zcp->do_force) {
+               if ((st.st_mode & S_IWGRP) && !zcp->do_force) {
                        zed_log_msg(LOG_NOTICE,
                            "Ignoring \"%s\": writable by group",
                            direntp->d_name);
                        continue;
                }
-               if ((st.st_mode & S_IWOTH) & !zcp->do_force) {
+               if ((st.st_mode & S_IWOTH) && !zcp->do_force) {
                        zed_log_msg(LOG_NOTICE,
                            "Ignoring \"%s\": writable by other",
                            direntp->d_name);