From fedd793ceaf3c2b5f9a8908cedf95b0aaccf3ea4 Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Sun, 9 May 2021 14:16:11 +0900 Subject: [PATCH 1/3] test: add one more assertion to make Coverty happy Fixes CID#1452934. --- src/test/test-strbuf.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/test/test-strbuf.c b/src/test/test-strbuf.c index 0cdef3fb72..a7c2f83c73 100644 --- a/src/test/test-strbuf.c +++ b/src/test/test-strbuf.c @@ -29,6 +29,7 @@ static void test_strbuf(void) { /* check the content of the buffer directly */ l = strv_parse_nulstr(sb->buf, sb->len); + assert_se(l); assert_se(streq(l[0], "")); /* root */ assert_se(streq(l[1], "waldo")); From 6ac6549251885a9b413676b116a696a2599b410c Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Sun, 9 May 2021 14:33:20 +0900 Subject: [PATCH 2/3] userdb: shorten code a bit Hopefully fixes CID#1452937. --- src/userdb/userwork.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/userdb/userwork.c b/src/userdb/userwork.c index 71251ccf1d..418a2892ac 100644 --- a/src/userdb/userwork.c +++ b/src/userdb/userwork.c @@ -393,13 +393,10 @@ static int vl_method_get_memberships(Varlink *link, JsonVariant *parameters, Var JSON_BUILD_PAIR("groupName", JSON_BUILD_STRING(last_group_name)))); if (r < 0) return r; - - free(last_user_name); - free(last_group_name); } - last_user_name = TAKE_PTR(user_name); - last_group_name = TAKE_PTR(group_name); + free_and_replace(last_user_name, user_name); + free_and_replace(last_group_name, group_name); } if (!last_user_name) { From 19cc6d5e54161e5af93b2bd8ba6a990168537bb5 Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Sun, 9 May 2021 14:36:19 +0900 Subject: [PATCH 3/3] tree-wide: fix typo --- src/basic/process-util.c | 2 +- src/libsystemd-network/sd-dhcp-server.c | 2 +- src/shared/dissect-image.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/basic/process-util.c b/src/basic/process-util.c index 4cd8287bb0..de28daf2b1 100644 --- a/src/basic/process-util.c +++ b/src/basic/process-util.c @@ -190,7 +190,7 @@ int get_process_cmdline(pid_t pid, size_t max_columns, ProcessCmdlineFlags flags assert(line); assert(pid >= 0); - /* Retrieve adn format a commandline. See above for discussion of retrieval options. + /* Retrieve and format a commandline. See above for discussion of retrieval options. * * There are two main formatting modes: * diff --git a/src/libsystemd-network/sd-dhcp-server.c b/src/libsystemd-network/sd-dhcp-server.c index 05c8a0eae4..4713561904 100644 --- a/src/libsystemd-network/sd-dhcp-server.c +++ b/src/libsystemd-network/sd-dhcp-server.c @@ -1082,7 +1082,7 @@ static int server_receive_message(sd_event_source *s, int fd, size_t buflen = datagram_size; if (sd_dhcp_server_is_in_relay_mode(server)) - /* Preallocate the additional size for DHCP Relay Agent Information Option if neeeded */ + /* Preallocate the additional size for DHCP Relay Agent Information Option if needed */ buflen += relay_agent_information_length(server->agent_circuit_id, server->agent_remote_id) + 2; message = malloc(buflen); diff --git a/src/shared/dissect-image.h b/src/shared/dissect-image.h index c961ee3e71..1ce14e915e 100644 --- a/src/shared/dissect-image.h +++ b/src/shared/dissect-image.h @@ -112,7 +112,7 @@ typedef enum DissectImageFlags { DISSECT_IMAGE_READ_ONLY = DISSECT_IMAGE_DEVICE_READ_ONLY | DISSECT_IMAGE_MOUNT_READ_ONLY, DISSECT_IMAGE_GROWFS = 1 << 18, /* Grow file systems in partitions marked for that to the size of the partitions after mount */ - DISSECT_IMAGE_MOUNT_IDMAPPED = 1 << 19, /* Mount mounts with kernel 5.12-style userns ID mapping, if file sytem type doesn't support uid=/gid= */ + DISSECT_IMAGE_MOUNT_IDMAPPED = 1 << 19, /* Mount mounts with kernel 5.12-style userns ID mapping, if file system type doesn't support uid=/gid= */ } DissectImageFlags; struct DissectedImage {