--- /dev/null
+/* SPDX-License-Identifier: LGPL-2.1-or-later */
+@@
+expression r;
+@@
+- (r < 0 && ERRNO_IS_TRANSIENT(r))
++ ERRNO_IS_NEG_TRANSIENT(r)
+@@
+expression r;
+@@
+- (r < 0 && ERRNO_IS_DISCONNECT(r))
++ ERRNO_IS_NEG_DISCONNECT(r)
+@@
+expression r;
+@@
+- (r < 0 && ERRNO_IS_ACCEPT_AGAIN(r))
++ ERRNO_IS_NEG_ACCEPT_AGAIN(r)
+@@
+expression r;
+@@
+- (r < 0 && ERRNO_IS_RESOURCE(r))
++ ERRNO_IS_NEG_RESOURCE(r)
+@@
+expression r;
+@@
+- (r < 0 && ERRNO_IS_NOT_SUPPORTED(r))
++ ERRNO_IS_NEG_NOT_SUPPORTED(r)
+@@
+expression r;
+@@
+- (r < 0 && ERRNO_IS_PRIVILEGE(r))
++ ERRNO_IS_NEG_PRIVILEGE(r)
+@@
+expression r;
+@@
+- (r < 0 && ERRNO_IS_DISK_SPACE(r))
++ ERRNO_IS_NEG_DISK_SPACE(r)
+@@
+expression r;
+@@
+- (r < 0 && ERRNO_IS_DEVICE_ABSENT(r))
++ ERRNO_IS_NEG_DEVICE_ABSENT(r)
+@@
+expression r;
+@@
+- (r < 0 && ERRNO_IS_XATTR_ABSENT(r))
++ ERRNO_IS_NEG_XATTR_ABSENT(r)
return 0;
r = netlink_poll(nl, false, timeout_usec);
- if (r < 0 && ERRNO_IS_TRANSIENT(r)) /* Convert EINTR to "something happened" and give user a chance to run some code before calling back into us */
+ if (ERRNO_IS_NEG_TRANSIENT(r)) /* Convert EINTR to "something happened" and give user a chance to run some code before calling back into us */
return 1;
return r;
}
dns_transaction_complete(t, DNS_TRANSACTION_RR_TYPE_UNSUPPORTED);
return 0;
}
- if (t->scope->protocol == DNS_PROTOCOL_LLMNR && r < 0 && ERRNO_IS_DISCONNECT(r)) {
+ if (t->scope->protocol == DNS_PROTOCOL_LLMNR && ERRNO_IS_NEG_DISCONNECT(r)) {
/* On LLMNR, if we cannot connect to a host via TCP when doing reverse lookups. This means we cannot
* answer this request with this protocol. */
dns_transaction_complete(t, DNS_TRANSACTION_NOT_FOUND);
assert(cgfd >= 0 || path);
r = getxattr_malloc(cgfd < 0 ? path : FORMAT_PROC_FD_PATH(cgfd), "trusted.delegate", &b);
- if (r < 0 && ERRNO_IS_XATTR_ABSENT(r)) {
+ if (ERRNO_IS_NEG_XATTR_ABSENT(r)) {
/* If the trusted xattr isn't set (preferred), then check the untrusted one. Under the
* assumption that whoever is trusted enough to own the cgroup, is also trusted enough to
* decide if it is delegated or not this should be safe. */
r = getxattr_malloc(cgfd < 0 ? path : FORMAT_PROC_FD_PATH(cgfd), "user.delegate", &b);
- if (r < 0 && ERRNO_IS_XATTR_ABSENT(r))
+ if (ERRNO_IS_NEG_XATTR_ABSENT(r))
return false;
}
if (r < 0)
return events;
r = fd_wait_for_event(fd, events, t);
- if (r < 0 && ERRNO_IS_TRANSIENT(r)) /* Treat EINTR as not a timeout, but also nothing happened, and
- * the caller gets a chance to call back into us */
+ if (ERRNO_IS_NEG_TRANSIENT(r)) /* Treat EINTR as not a timeout, but also nothing happened, and
+ * the caller gets a chance to call back into us */
return 1;
if (r <= 0)
return r;
assert_se(architecture_from_string(architecture_to_string(1)) == 1);
v = detect_virtualization();
- if (v < 0 && ERRNO_IS_PRIVILEGE(v))
+ if (ERRNO_IS_NEG_PRIVILEGE(v))
return log_tests_skipped("Cannot detect virtualization");
assert_se(v >= 0);
*/
Virtualization v = detect_virtualization();
- if (v < 0 && ERRNO_IS_PRIVILEGE(v))
+ if (ERRNO_IS_NEG_PRIVILEGE(v))
return log_tests_skipped("Cannot detect virtualization");
if (v != VIRTUALIZATION_NONE)
int r;
r = path_is_encrypted(p);
- if (r == -ENOENT || (r < 0 && ERRNO_IS_PRIVILEGE(r)))
+ if (r == -ENOENT || ERRNO_IS_NEG_PRIVILEGE(r))
/* This might fail, if btrfs is used and we run in a container. In that case we cannot
* resolve the device node paths that BTRFS_IOC_DEV_INFO returns, because the device nodes
* are unlikely to exist in the container. But if we can't stat() them we cannot determine
int r;
r = read_one_line_file("/proc/sys/kernel/cap_last_cap", &content);
- if (r == -ENOENT || (r < 0 && ERRNO_IS_PRIVILEGE(r))) /* kernel pre 3.2 or no access */
+ if (r == -ENOENT || ERRNO_IS_NEG_PRIVILEGE(r)) /* kernel pre 3.2 or no access */
return;
assert_se(r >= 0);
int r;
r = read_one_line_file("/proc/sys/kernel/cap_last_cap", &content);
- if (r == -ENOENT || (r < 0 && ERRNO_IS_PRIVILEGE(r))) /* kernel pre 3.2 or no access */
+ if (r == -ENOENT || ERRNO_IS_NEG_PRIVILEGE(r)) /* kernel pre 3.2 or no access */
return;
assert_se(r >= 0);
int r;
r = read_one_line_file("/proc/version", &buf);
- if (r < 0 && ERRNO_IS_PRIVILEGE(r))
+ if (ERRNO_IS_NEG_PRIVILEGE(r))
return;
assert_se(r >= 0);
assert_se(buf2 = strjoin(buf, "\n"));
FORK_MOUNTNS_SLAVE,
NULL);
- if (r < 0 && ERRNO_IS_PRIVILEGE(r)) {
- log_notice("Skipping umount_recursive() test, lacking privileges");
- return;
- }
+ if (ERRNO_IS_NEG_PRIVILEGE(r))
+ return (void) log_notice("Skipping umount_recursive() test, lacking privileges");
assert_se(r >= 0);
if (r == 0) { /* child */
assert_se(mkdtemp_malloc(NULL, &a) >= 0);
r = mount_nofollow_verbose(LOG_INFO, "tmpfs", a, "tmpfs", 0, NULL);
- if (r < 0 && ERRNO_IS_PRIVILEGE(r)) {
- (void) log_tests_skipped("Skipping bind_mount_submounts() test, lacking privileges");
- return;
- }
+ if (ERRNO_IS_NEG_PRIVILEGE(r))
+ return (void) log_tests_skipped("Skipping bind_mount_submounts() test, lacking privileges");
+
assert_se(r >= 0);
assert_se(x = path_join(a, "foo"));
pid_max = TASKS_MAX;
r = procfs_get_pid_max(&pid_max);
- if (r == -ENOENT || (r < 0 && ERRNO_IS_PRIVILEGE(r)))
+ if (r == -ENOENT || ERRNO_IS_NEG_PRIVILEGE(r))
return log_tests_skipped_errno(r, "can't get pid max");
assert(r >= 0);
log_info("kernel.pid_max: %"PRIu64, pid_max);
threads_max = TASKS_MAX;
r = procfs_get_threads_max(&threads_max);
- if (r == -ENOENT || (r < 0 && ERRNO_IS_PRIVILEGE(r)))
+ if (r == -ENOENT || ERRNO_IS_NEG_PRIVILEGE(r))
return log_tests_skipped_errno(r, "can't get threads max");
assert(r >= 0);
log_info("kernel.threads-max: %"PRIu64, threads_max);
} else
r = 0;
- if (!subvol || (r < 0 && ERRNO_IS_NOT_SUPPORTED(r)))
+ if (!subvol || ERRNO_IS_NEG_NOT_SUPPORTED(r))
WITH_UMASK(0000)
r = mkdirat_label(pfd, bn, mode);