diff options
author | Luca Boccassi <luca.boccassi@microsoft.com> | 2021-08-20 18:15:35 +0100 |
---|---|---|
committer | Luca Boccassi <luca.boccassi@microsoft.com> | 2021-08-20 18:29:30 +0100 |
commit | 272fff7d8421767ef2caa60e982cf1bdae2c086c (patch) | |
tree | aa5a06e1fb4230bbb18edefdca29ff9b6f84aafd | |
parent | e4193309c4d5743499a9ed2361918447e02e094e (diff) | |
download | systemd-272fff7d8421767ef2caa60e982cf1bdae2c086c.tar.gz |
format-util/sd-bus: do not ignore snprintf result
-rw-r--r-- | src/basic/format-util.c | 4 | ||||
-rw-r--r-- | src/libsystemd/sd-bus/bus-match.c | 12 |
2 files changed, 6 insertions, 10 deletions
diff --git a/src/basic/format-util.c b/src/basic/format-util.c index 9920604f3a..8174eaa81b 100644 --- a/src/basic/format-util.c +++ b/src/basic/format-util.c @@ -15,9 +15,9 @@ char *format_ifname_full(int ifindex, char buf[static IF_NAMESIZE + 1], FormatIf return NULL; if (FLAGS_SET(flag, FORMAT_IFNAME_IFINDEX_WITH_PERCENT)) - snprintf(buf, IF_NAMESIZE + 1, "%%%d", ifindex); + assert(snprintf_ok(buf, IF_NAMESIZE + 1, "%%%d", ifindex)); else - snprintf(buf, IF_NAMESIZE + 1, "%d", ifindex); + assert(snprintf_ok(buf, IF_NAMESIZE + 1, "%d", ifindex)); return buf; } diff --git a/src/libsystemd/sd-bus/bus-match.c b/src/libsystemd/sd-bus/bus-match.c index ff8cf4ee0e..12a50845db 100644 --- a/src/libsystemd/sd-bus/bus-match.c +++ b/src/libsystemd/sd-bus/bus-match.c @@ -997,20 +997,16 @@ const char* bus_match_node_type_to_string(enum bus_match_node_type t, char buf[] return "path_namespace"; case BUS_MATCH_ARG ... BUS_MATCH_ARG_LAST: - snprintf(buf, l, "arg%i", t - BUS_MATCH_ARG); - return buf; + return snprintf_ok(buf, l, "arg%i", t - BUS_MATCH_ARG); case BUS_MATCH_ARG_PATH ... BUS_MATCH_ARG_PATH_LAST: - snprintf(buf, l, "arg%ipath", t - BUS_MATCH_ARG_PATH); - return buf; + return snprintf_ok(buf, l, "arg%ipath", t - BUS_MATCH_ARG_PATH); case BUS_MATCH_ARG_NAMESPACE ... BUS_MATCH_ARG_NAMESPACE_LAST: - snprintf(buf, l, "arg%inamespace", t - BUS_MATCH_ARG_NAMESPACE); - return buf; + return snprintf_ok(buf, l, "arg%inamespace", t - BUS_MATCH_ARG_NAMESPACE); case BUS_MATCH_ARG_HAS ... BUS_MATCH_ARG_HAS_LAST: - snprintf(buf, l, "arg%ihas", t - BUS_MATCH_ARG_HAS); - return buf; + return snprintf_ok(buf, l, "arg%ihas", t - BUS_MATCH_ARG_HAS); default: return NULL; |