tree-wide: coccinelle fixes
Yet another batch of Coccinelle fixes.
This commit is contained in:
committed by
Luca Boccassi
parent
0de0ba573b
commit
2f0927626a
+1
-1
@@ -382,7 +382,7 @@ int systemd_efi_options_efivarfs_if_newer(char **line) {
|
||||
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.");
|
||||
|
||||
@@ -1334,10 +1334,10 @@ static int get_timezones_from_tzdata_zi(char ***ret) {
|
||||
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
|
||||
|
||||
+3
-3
@@ -362,7 +362,7 @@ static int verb_encrypt(int argc, char **argv, void *userdata) {
|
||||
|
||||
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);
|
||||
@@ -373,7 +373,7 @@ static int verb_encrypt(int argc, char **argv, void *userdata) {
|
||||
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;
|
||||
@@ -455,7 +455,7 @@ static int verb_decrypt(int argc, char **argv, void *userdata) {
|
||||
|
||||
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);
|
||||
|
||||
@@ -238,7 +238,7 @@ int sd_dhcp_client_set_callback(
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -171,10 +171,8 @@ static int find_free_uid(const char *directory, uid_t max_uid, uid_t *current_ui
|
||||
|
||||
/* 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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -4091,7 +4091,7 @@ static int make_uid_map_string(
|
||||
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
|
||||
|
||||
@@ -86,10 +86,8 @@ static PortableMetadata *portable_metadata_new(const char *name, const char *pat
|
||||
/* 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);
|
||||
|
||||
Reference in New Issue
Block a user