summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--coccinelle/strempty.cocci16
-rw-r--r--src/home/homework.c7
-rw-r--r--src/libsystemd-network/sd-dhcp-lease.c4
-rw-r--r--src/libsystemd-network/sd-dhcp-server.c4
-rw-r--r--src/test/test-install-root.c3
5 files changed, 23 insertions, 11 deletions
diff --git a/coccinelle/strempty.cocci b/coccinelle/strempty.cocci
index 7901da3652..0868184c5d 100644
--- a/coccinelle/strempty.cocci
+++ b/coccinelle/strempty.cocci
@@ -1,6 +1,18 @@
@@
-/* Avoid running this transformation on the strempty function itself */
-position p : script:python() { p[0].current_element != "strempty" };
+/* Avoid running this transformation on the strempty function itself and
+ * on the "make_expression" macro in src/libsystemd/sd-bus/bus-convenience.c.
+ * As Coccinelle's Location object doesn't support macro "detection", use
+ * a pretty horrifying combo of specifying a file and a special "something_else"
+ * position element, which is, apparently, the default value of
+ * "current_element" before it's set (according to the source code), thus
+ * matching any "top level" position, including macros. Let's hope we never
+ * introduce a function called "something_else"...
+ */
+position p : script:python() {
+ not (p[0].current_element == "strempty" or
+ (p[0].file == "src/libsystemd/sd-bus/bus-convenience.c" and
+ p[0].current_element == "something_else"))
+};
expression s;
@@
(
diff --git a/src/home/homework.c b/src/home/homework.c
index fc9f030392..38b740729c 100644
--- a/src/home/homework.c
+++ b/src/home/homework.c
@@ -1038,10 +1038,9 @@ static int home_remove(UserRecord *h) {
if (deleted)
log_info("Everything completed.");
- else {
- log_notice("Nothing to remove.");
- return -EALREADY;
- }
+ else
+ return log_notice_errno(SYNTHETIC_ERRNO(EALREADY),
+ "Nothing to remove.");
return 0;
}
diff --git a/src/libsystemd-network/sd-dhcp-lease.c b/src/libsystemd-network/sd-dhcp-lease.c
index 5154af2304..57b412b6cd 100644
--- a/src/libsystemd-network/sd-dhcp-lease.c
+++ b/src/libsystemd-network/sd-dhcp-lease.c
@@ -141,8 +141,8 @@ int sd_dhcp_lease_get_servers(
return (int) lease->smtp_server_size;
default:
- log_debug("Uknown DHCP lease info item %d.", what);
- return -ENXIO;
+ return log_debug_errno(SYNTHETIC_ERRNO(ENXIO),
+ "Uknown DHCP lease info item %d.", what);
}
}
diff --git a/src/libsystemd-network/sd-dhcp-server.c b/src/libsystemd-network/sd-dhcp-server.c
index a4dcddd95d..3a75649aed 100644
--- a/src/libsystemd-network/sd-dhcp-server.c
+++ b/src/libsystemd-network/sd-dhcp-server.c
@@ -1162,8 +1162,8 @@ int sd_dhcp_server_set_servers(
break;
default:
- log_debug("Uknown DHCP lease info item %d.", what);
- return -ENXIO;
+ return log_debug_errno(SYNTHETIC_ERRNO(ENXIO),
+ "Uknown DHCP lease info item %d.", what);
}
if (*n_a == n_addresses &&
diff --git a/src/test/test-install-root.c b/src/test/test-install-root.c
index 0dabc9782e..79a105c5c3 100644
--- a/src/test/test-install-root.c
+++ b/src/test/test-install-root.c
@@ -1058,7 +1058,8 @@ static void verify_one(
r = unit_file_verify_alias(i, alias, &alias2);
log_info_errno(r, "alias %s ← %s: %d/%m (expected %d)%s%s%s",
i->name, alias, r, expected,
- alias2 ? " [" : "", alias2 ?: "", alias2 ? "]" : "");
+ alias2 ? " [" : "", strempty(alias2),
+ alias2 ? "]" : "");
assert(r == expected);
/* This is is test for "instance propagation". This propagation matters mostly for WantedBy= and