Yet another batch of Coccinelle fixes.
return log_debug_errno(errno, "Failed to stat EFI variable SystemdOptions: %m");
if (stat(EFIVAR_CACHE_PATH(EFI_SYSTEMD_VARIABLE(SystemdOptions)), &b) < 0) {
- if (errno != -ENOENT)
+ if (errno != ENOENT)
log_debug_errno(errno, "Failed to stat "EFIVAR_CACHE_PATH(EFI_SYSTEMD_VARIABLE(SystemdOptions))": %m");
} else if (compare_stat_mtime(&a, &b) > 0)
log_debug("Variable SystemdOptions in evifarfs is newer than in cache.");
continue;
char *tz;
- if (*type == 'Z' || *type == 'z')
+ if (IN_SET(*type, 'Z', 'z'))
/* Zone lines have timezone in field 1. */
tz = f1;
- else if (*type == 'L' || *type == 'l')
+ else if (IN_SET(*type, 'L', 'l'))
/* Link lines have timezone in field 2. */
tz = f2;
else
assert(argc == 3);
- input_path = (isempty(argv[1]) || streq(argv[1], "-")) ? NULL : argv[1];
+ input_path = empty_or_dash(argv[1]) ? NULL : argv[1];
if (input_path)
r = read_full_file_full(AT_FDCWD, input_path, UINT64_MAX, CREDENTIAL_SIZE_MAX, READ_FULL_FILE_SECURE|READ_FULL_FILE_FAIL_WHEN_LARGER, NULL, &plaintext, &plaintext_size);
if (r < 0)
return log_error_errno(r, "Failed to read plaintext: %m");
- output_path = (isempty(argv[2]) || streq(argv[2], "-")) ? NULL : argv[2];
+ output_path = empty_or_dash(argv[2]) ? NULL : argv[2];
if (arg_name_any)
name = NULL;
assert(IN_SET(argc, 2, 3));
- input_path = (isempty(argv[1]) || streq(argv[1], "-")) ? NULL : argv[1];
+ input_path = empty_or_dash(argv[1]) ? NULL : argv[1];
if (input_path)
r = read_full_file_full(AT_FDCWD, argv[1], UINT64_MAX, CREDENTIAL_ENCRYPTED_SIZE_MAX, READ_FULL_FILE_UNBASE64|READ_FULL_FILE_FAIL_WHEN_LARGER, NULL, &input, &input_size);
int sd_dhcp_client_set_request_broadcast(sd_dhcp_client *client, int broadcast) {
assert_return(client, -EINVAL);
- client->request_broadcast = !!broadcast;
+ client->request_broadcast = broadcast;
return 0;
}
/* We want to use the UID also as GID, hence check for it in /etc/group too */
r = check_etc_group_collisions(directory, NULL, (gid_t) *current_uid);
- if (r < 0)
+ if (r <= 0)
return r;
- if (r == 0) /* free! yay! */
- return 0;
}
}
int r;
assert(n_bind_user_uid == 0 || bind_user_uid);
- assert(offset == 0 || offset == 2); /* used to switch between UID and GID map */
+ assert(IN_SET(offset, 0, 2)); /* used to switch between UID and GID map */
assert(ret);
/* The bind_user_uid[] array is a series of 4 uid_t values, for each --bind-user= entry one
/* In case of a layered attach, we want to remember which image the unit came from */
if (path) {
m->image_path = strdup(path);
- if (!m->image_path) {
- free(m);
- return NULL;
- }
+ if (!m->image_path)
+ return mfree(m);
}
strcpy(m->name, name);