return -errno;
if (!S_ISDIR(st.st_mode))
return -ENOTDIR;
- if ((st.st_mode & 0700) == 0700) /* Already set? */
+ if (FLAGS_SET(st.st_mode, 0700)) /* Already set? */
return -EACCES; /* original error */
if (st.st_uid != geteuid()) /* this only works if the UID matches ours */
return -EACCES;
done = true;
HASHMAP_FOREACH_KEY(di.data, other, u->dependencies[d]) {
- if ((di.origin_mask & ~mask) == di.origin_mask)
+ if (FLAGS_SET(~mask, di.origin_mask))
continue;
di.origin_mask &= ~mask;
unit_update_dependency_mask(u, d, other, di);
UnitDependencyInfo dj;
dj.data = hashmap_get(other->dependencies[q], u);
- if ((dj.destination_mask & ~mask) == dj.destination_mask)
+ if (FLAGS_SET(~mask, dj.destination_mask))
continue;
dj.destination_mask &= ~mask;
return r;
n += r;
- } else if ((c & 0xc0) == 0xc0) {
+ } else if (FLAGS_SET(c, 0xc0)) {
/* Pointer */
uint8_t d;
assert_return(duid_len == 0 || duid != NULL, -EINVAL);
assert_return(IN_SET(client->state, DHCP6_STATE_STOPPED), -EBUSY);
- if (duid != NULL) {
+ if (duid) {
r = dhcp_validate_duid_len(duid_type, duid_len, true);
if (r < 0) {
r = dhcp_validate_duid_len(duid_type, duid_len, false);
if (c->utc)
fputs(" UTC", f);
- else if (c->timezone != NULL) {
+ else if (c->timezone) {
fputc(' ', f);
fputs(c->timezone, f);
} else if (IN_SET(c->dst, 0, 1)) {
if (fd < 0)
return -errno;
- if (!uid_is_valid(uid) && !gid_is_valid(gid) && (mask & 07777) == 07777)
+ if (!uid_is_valid(uid) && !gid_is_valid(gid) && FLAGS_SET(mask, 07777))
return 0; /* nothing to do */
if (fstat(fd, &st) < 0)
if (!S_ISDIR(st.st_mode))
return -ENOTDIR;
- if (!uid_is_valid(uid) && !gid_is_valid(gid) && (mask & 07777) == 07777)
+ if (!uid_is_valid(uid) && !gid_is_valid(gid) && FLAGS_SET(mask, 07777))
return 0; /* nothing to do */
/* Shortcut, as above */
c = strjoina(a, "/tmp");
assert_se(stat(c, &x) >= 0);
assert_se(S_ISDIR(x.st_mode));
- assert_se((x.st_mode & 01777) == 01777);
+ assert_se(FLAGS_SET(x.st_mode, 01777));
assert_se(rmdir(c) >= 0);
assert_se(rmdir(a) >= 0);
}
d = strjoina(b, "/tmp");
assert_se(stat(d, &y) >= 0);
assert_se(S_ISDIR(y.st_mode));
- assert_se((y.st_mode & 01777) == 01777);
+ assert_se(FLAGS_SET(y.st_mode, 01777));
assert_se(rmdir(d) >= 0);
assert_se(rmdir(b) >= 0);
}
retval = -1;
break;
}
- if (vendor == NULL) {
+ if (!vendor) {
if (!vendor_in)
break;
} else if (vendor_in &&