eBPF-based security platform
util: drop __must_check from iso8601() and upatch_resolve_location()
Daniel Borkmann01f38954ecc8
diff --git a/builtin-status.c b/builtin-status.cindex d16c3104..67e25482 100644--- a/builtin-status.c+++ b/builtin-status.c@@ -447,9 +447,8 @@ static int java_row(const char *name,strscpy_literal(r->name, "?");strscpy_literal(r->location, "java");hex_encode(payload, UPATCH_PAYLOAD_HASH_LEN, r->payload_sha256);- if (java_agent_path(name, path, sizeof(path)) || stat(path, &st) ||- iso8601(st.st_ctim.tv_sec, r->loaded_at, sizeof(r->loaded_at)))- r->loaded_at[0] = '\0';+ if (!java_agent_path(name, path, sizeof(path)) && !stat(path, &st))+ iso8601(st.st_ctim.tv_sec, r->loaded_at, sizeof(r->loaded_at));r->age_sec = upatch_age_sec(r->loaded_at);return 0;}diff --git a/util/eventlog.c b/util/eventlog.cindex d7c0450e..7ddc0251 100644--- a/util/eventlog.c+++ b/util/eventlog.c@@ -732,8 +732,7 @@ int eventlog_upatches_record(const char *line, size_t len, bool is_init,void eventlog_timestamp(char *out, size_t cap){- if (iso8601(time(NULL), out, cap))- out[0] = '\0';+ iso8601(time(NULL), out, cap);}void eventlog_boot_id(char *out, size_t cap)diff --git a/util/timefmt.h b/util/timefmt.hindex b014415f..7cc4e911 100644--- a/util/timefmt.h+++ b/util/timefmt.h@@ -17,6 +17,6 @@int format_duration(long seconds, char *buf, size_t cap) __must_check;/* UTC to the second; "" and -EINVAL when t cannot be rendered. */-int iso8601(time_t t, char *out, size_t cap) __must_check;+int iso8601(time_t t, char *out, size_t cap);#endif /* SHIRUDO_TIMEFMT_H */diff --git a/util/upatch_maps.c b/util/upatch_maps.cindex 4ebc8062..4965b02f 100644--- a/util/upatch_maps.c+++ b/util/upatch_maps.c@@ -55,9 +55,8 @@ static void resolve_map_location(struct map_view *v)vbtf = btf__load_vmlinux_btf();if (libbpf_get_error(vbtf))vbtf = NULL;- if (upatch_resolve_location(vbtf, v->upatch, v->location,- sizeof(v->location)))- v->location[0] = '\0';+ upatch_resolve_location(vbtf, v->upatch,+ v->location, sizeof(v->location));btf__free(vbtf);}diff --git a/util/upatch_resolve.c b/util/upatch_resolve.cindex 5bb8b517..e27437ac 100644--- a/util/upatch_resolve.c+++ b/util/upatch_resolve.c@@ -506,8 +506,9 @@ void upatch_loaded_at(const char *name, char *out, size_t cap)if (!upatch_pins_read(name, &pins) && pins.nr_xdp_progs &&upatch_xdp_prog_pin(dir, sizeof(dir), name, pins.first_xdp_prog))return;- if (stat(dir, &st) || iso8601(st.st_ctim.tv_sec, out, cap))- out[0] = '\0';+ if (stat(dir, &st) != 0)+ return;+ iso8601(st.st_ctim.tv_sec, out, cap);}void upatch_payload_sha256(const char *name, char *out, size_t cap)diff --git a/util/upatch_resolve.h b/util/upatch_resolve.hindex 31be9ba8..8d067a12 100644--- a/util/upatch_resolve.h+++ b/util/upatch_resolve.h@@ -11,7 +11,6 @@#include <stdbool.h>#include <stddef.h>-#include <shirudo/compiler.h>#include <shirudo/types.h>struct bpf_link_info;@@ -43,7 +42,7 @@ int upatch_first_prog_id(const char *name, __u32 *out);* failure out is empty.*/int upatch_resolve_location(struct btf *vbtf, const char *name,- char *out, size_t cap) __must_check;+ char *out, size_t cap);/** The runs the kernel skipped of one program of an upatch: the program's