From 711650ee7c0799c56c177dd363fe43dc9492c3aa Mon Sep 17 00:00:00 2001 From: David Oberhollenzer Date: Fri, 19 Feb 2021 19:51:58 +0100 Subject: Fix: libfstree: add an assert the canonicalize_name return value Since the canonicalize_name function only fails if the path contains ".." and the one we are constructing from the scanned fstree (built using canonicalized names), it should NEVER fail. However, coverity does get concerned, because we are checking the return value elesewhere. So do what we do at other, similar locations and add an assert(). Signed-off-by: David Oberhollenzer --- lib/fstree/fstree_from_file.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/fstree/fstree_from_file.c b/lib/fstree/fstree_from_file.c index 465f81d..9a34b36 100644 --- a/lib/fstree/fstree_from_file.c +++ b/lib/fstree/fstree_from_file.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include @@ -152,7 +153,8 @@ static int glob_node_callback(void *user, fstree_t *fs, tree_node_t *node) return -1; } - canonicalize_name(path); + ret = canonicalize_name(path); + assert(ret == 0); ret = fnmatch(ctx->name_pattern, path, FNM_PATHNAME); free(path); -- cgit v1.2.3