tree-wide: assorted coccinelle fixes

This commit is contained in:
Frantisek Sumsal
2020-10-09 15:02:23 +02:00
parent 44e66de0f2
commit d7a0f1f4f9
56 changed files with 351 additions and 399 deletions
+7 -6
View File
@@ -126,10 +126,10 @@ static int import_fs(int argc, char *argv[], void *userdata) {
local = empty_or_dash_to_null(local);
if (local) {
if (!machine_name_is_valid(local)) {
log_error("Local image name '%s' is not valid.", local);
return -EINVAL;
}
if (!machine_name_is_valid(local))
return log_error_errno(SYNTHETIC_ERRNO(EINVAL),
"Local image name '%s' is not valid.",
local);
if (!arg_force) {
r = image_find(IMAGE_MACHINE, local, NULL);
@@ -137,8 +137,9 @@ static int import_fs(int argc, char *argv[], void *userdata) {
if (r != -ENOENT)
return log_error_errno(r, "Failed to check whether image '%s' exists: %m", local);
} else {
log_error("Image '%s' already exists.", local);
return -EEXIST;
return log_error_errno(SYNTHETIC_ERRNO(EEXIST),
"Image '%s' already exists.",
local);
}
}
} else
+14 -12
View File
@@ -64,10 +64,10 @@ static int import_tar(int argc, char *argv[], void *userdata) {
local = ll;
if (!machine_name_is_valid(local)) {
log_error("Local image name '%s' is not valid.", local);
return -EINVAL;
}
if (!machine_name_is_valid(local))
return log_error_errno(SYNTHETIC_ERRNO(EINVAL),
"Local image name '%s' is not valid.",
local);
if (!arg_force) {
r = image_find(IMAGE_MACHINE, local, NULL);
@@ -75,8 +75,9 @@ static int import_tar(int argc, char *argv[], void *userdata) {
if (r != -ENOENT)
return log_error_errno(r, "Failed to check whether image '%s' exists: %m", local);
} else {
log_error("Image '%s' already exists.", local);
return -EEXIST;
return log_error_errno(SYNTHETIC_ERRNO(EEXIST),
"Image '%s' already exists.",
local);
}
}
} else
@@ -158,10 +159,10 @@ static int import_raw(int argc, char *argv[], void *userdata) {
local = ll;
if (!machine_name_is_valid(local)) {
log_error("Local image name '%s' is not valid.", local);
return -EINVAL;
}
if (!machine_name_is_valid(local))
return log_error_errno(SYNTHETIC_ERRNO(EINVAL),
"Local image name '%s' is not valid.",
local);
if (!arg_force) {
r = image_find(IMAGE_MACHINE, local, NULL);
@@ -169,8 +170,9 @@ static int import_raw(int argc, char *argv[], void *userdata) {
if (r != -ENOENT)
return log_error_errno(r, "Failed to check whether image '%s' exists: %m", local);
} else {
log_error("Image '%s' already exists.", local);
return -EEXIST;
return log_error_errno(SYNTHETIC_ERRNO(EEXIST),
"Image '%s' already exists.",
local);
}
}
} else
+6 -8
View File
@@ -389,10 +389,9 @@ int pull_verify(PullJob *main_job,
assert(checksum_job->state == PULL_JOB_DONE);
if (!checksum_job->payload || checksum_job->payload_size <= 0) {
log_error("Checksum is empty, cannot verify.");
return -EBADMSG;
}
if (!checksum_job->payload || checksum_job->payload_size <= 0)
return log_error_errno(SYNTHETIC_ERRNO(EBADMSG),
"Checksum is empty, cannot verify.");
r = verify_one(checksum_job, main_job);
if (r < 0)
@@ -414,10 +413,9 @@ int pull_verify(PullJob *main_job,
assert(signature_job->state == PULL_JOB_DONE);
if (!signature_job->payload || signature_job->payload_size <= 0) {
log_error("Signature is empty, cannot verify.");
return -EBADMSG;
}
if (!signature_job->payload || signature_job->payload_size <= 0)
return log_error_errno(SYNTHETIC_ERRNO(EBADMSG),
"Signature is empty, cannot verify.");
r = pipe2(gpg_pipe, O_CLOEXEC);
if (r < 0)
+20 -20
View File
@@ -49,10 +49,9 @@ static int pull_tar(int argc, char *argv[], void *userdata) {
int r;
url = argv[1];
if (!http_url_is_valid(url)) {
log_error("URL '%s' is not valid.", url);
return -EINVAL;
}
if (!http_url_is_valid(url))
return log_error_errno(SYNTHETIC_ERRNO(EINVAL),
"URL '%s' is not valid.", url);
if (argc >= 3)
local = argv[2];
@@ -73,10 +72,10 @@ static int pull_tar(int argc, char *argv[], void *userdata) {
local = ll;
if (!machine_name_is_valid(local)) {
log_error("Local image name '%s' is not valid.", local);
return -EINVAL;
}
if (!machine_name_is_valid(local))
return log_error_errno(SYNTHETIC_ERRNO(EINVAL),
"Local image name '%s' is not valid.",
local);
if (!arg_force) {
r = image_find(IMAGE_MACHINE, local, NULL);
@@ -84,8 +83,9 @@ static int pull_tar(int argc, char *argv[], void *userdata) {
if (r != -ENOENT)
return log_error_errno(r, "Failed to check whether image '%s' exists: %m", local);
} else {
log_error("Image '%s' already exists.", local);
return -EEXIST;
return log_error_errno(SYNTHETIC_ERRNO(EEXIST),
"Image '%s' already exists.",
local);
}
}
@@ -135,10 +135,9 @@ static int pull_raw(int argc, char *argv[], void *userdata) {
int r;
url = argv[1];
if (!http_url_is_valid(url)) {
log_error("URL '%s' is not valid.", url);
return -EINVAL;
}
if (!http_url_is_valid(url))
return log_error_errno(SYNTHETIC_ERRNO(EINVAL),
"URL '%s' is not valid.", url);
if (argc >= 3)
local = argv[2];
@@ -159,10 +158,10 @@ static int pull_raw(int argc, char *argv[], void *userdata) {
local = ll;
if (!machine_name_is_valid(local)) {
log_error("Local image name '%s' is not valid.", local);
return -EINVAL;
}
if (!machine_name_is_valid(local))
return log_error_errno(SYNTHETIC_ERRNO(EINVAL),
"Local image name '%s' is not valid.",
local);
if (!arg_force) {
r = image_find(IMAGE_MACHINE, local, NULL);
@@ -170,8 +169,9 @@ static int pull_raw(int argc, char *argv[], void *userdata) {
if (r != -ENOENT)
return log_error_errno(r, "Failed to check whether image '%s' exists: %m", local);
} else {
log_error("Image '%s' already exists.", local);
return -EEXIST;
return log_error_errno(SYNTHETIC_ERRNO(EEXIST),
"Image '%s' already exists.",
local);
}
}