coccinelle: make use of SYNTHETIC_ERRNO

Ideally, coccinelle would strip unnecessary braces too. But I do not see any
option in coccinelle for this, so instead, I edited the patch text using
search&replace to remove the braces. Unfortunately this is not fully automatic,
in particular it didn't deal well with if-else-if-else blocks and ifdefs, so
there is an increased likelikehood be some bugs in such spots.

I also removed part of the patch that coccinelle generated for udev, where we
returns -1 for failure. This should be fixed independently.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2018-11-22 10:54:38 +01:00
parent 52d86690d6
commit baaa35ad70
129 changed files with 1932 additions and 2311 deletions
+12 -12
View File
@@ -310,10 +310,10 @@ int generator_hook_up_mkswap(
return log_oom();
/* Nothing to work on. */
if (!is_device_path(node)) {
log_error("Cannot format something that is not a device node: %s", node);
return -EINVAL;
}
if (!is_device_path(node))
return log_error_errno(SYNTHETIC_ERRNO(EINVAL),
"Cannot format something that is not a device node: %s",
node);
r = unit_name_from_path_instance("systemd-mkswap", node, ".service", &unit);
if (r < 0)
@@ -380,15 +380,15 @@ int generator_hook_up_mkfs(
return log_oom();
/* Nothing to work on. */
if (!is_device_path(node)) {
log_error("Cannot format something that is not a device node: %s", node);
return -EINVAL;
}
if (!is_device_path(node))
return log_error_errno(SYNTHETIC_ERRNO(EINVAL),
"Cannot format something that is not a device node: %s",
node);
if (!type || streq(type, "auto")) {
log_error("Cannot format partition %s, filesystem type is not specified", node);
return -EINVAL;
}
if (!type || streq(type, "auto"))
return log_error_errno(SYNTHETIC_ERRNO(EINVAL),
"Cannot format partition %s, filesystem type is not specified",
node);
r = unit_name_from_path_instance("systemd-mkfs", node, ".service", &unit);
if (r < 0)