tree-wide: use cocinnelle to apply _NEG_ macros
This commit is contained in:
@@ -21,7 +21,7 @@ int main(int argc, char *argv[]) {
|
||||
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);
|
||||
|
||||
@@ -429,7 +429,7 @@ static int intro(void) {
|
||||
*/
|
||||
|
||||
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)
|
||||
|
||||
@@ -8,7 +8,7 @@ static void test_path_is_encrypted_one(const char *p, int expect) {
|
||||
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
|
||||
|
||||
@@ -39,7 +39,7 @@ static void test_last_cap_file(void) {
|
||||
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);
|
||||
|
||||
@@ -235,7 +235,7 @@ static void test_ensure_cap_64_bit(void) {
|
||||
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);
|
||||
|
||||
|
||||
@@ -490,7 +490,7 @@ TEST(write_string_file_verify) {
|
||||
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"));
|
||||
|
||||
@@ -470,10 +470,8 @@ TEST(umount_recursive) {
|
||||
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 */
|
||||
@@ -575,10 +573,9 @@ TEST(bind_mount_submounts) {
|
||||
|
||||
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"));
|
||||
|
||||
@@ -28,14 +28,14 @@ int main(int argc, char *argv[]) {
|
||||
|
||||
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);
|
||||
|
||||
Reference in New Issue
Block a user