diff options
author | Frantisek Sumsal <frantisek@sumsal.cz> | 2020-10-09 14:59:44 +0200 |
---|---|---|
committer | Frantisek Sumsal <frantisek@sumsal.cz> | 2020-10-09 15:02:23 +0200 |
commit | d7a0f1f4f9910a1a2d290e31b2ba8cfa7126fbdd (patch) | |
tree | f519b20cb0835f71bd553abeca761882cad3299b /src/import/pull.c | |
parent | 44e66de0f25e65d5bd8b2f7f848e0fc7b98199ed (diff) | |
download | systemd-d7a0f1f4f9910a1a2d290e31b2ba8cfa7126fbdd.tar.gz |
tree-wide: assorted coccinelle fixes
Diffstat (limited to 'src/import/pull.c')
-rw-r--r-- | src/import/pull.c | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/src/import/pull.c b/src/import/pull.c index 7e8712493f..9b27ec2630 100644 --- a/src/import/pull.c +++ b/src/import/pull.c @@ -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); } } |