diff --git a/src/basic/chattr-util.c b/src/basic/chattr-util.c index 02d2cc2e52..9677e9a35a 100644 --- a/src/basic/chattr-util.c +++ b/src/basic/chattr-util.c @@ -6,6 +6,7 @@ #include #include +#include "bitfield.h" #include "chattr-util.h" #include "errno-util.h" #include "fd-util.h" @@ -93,11 +94,9 @@ int chattr_full( * supported, and we can ignore it too */ unsigned current_attr = old_attr; - for (unsigned i = 0; i < sizeof(unsigned) * 8; i++) { - unsigned new_one, mask_one = 1u << i; - if (!FLAGS_SET(mask, mask_one)) - continue; + BIT_FOREACH(i, mask) { + unsigned new_one, mask_one = 1u << i; new_one = UPDATE_FLAG(current_attr, mask_one, FLAGS_SET(value, mask_one)); if (new_one == current_attr)