summaryrefslogtreecommitdiff
path: root/lib/fstree
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2021-02-19 19:51:58 +0100
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2021-02-19 19:51:58 +0100
commit711650ee7c0799c56c177dd363fe43dc9492c3aa (patch)
tree2aa760f6527713877472f7fe666d1a5d5c607f3e /lib/fstree
parent05defb211e6da0297b72c8af9b177196426aed01 (diff)
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 <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'lib/fstree')
-rw-r--r--lib/fstree/fstree_from_file.c4
1 files changed, 3 insertions, 1 deletions
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 <fnmatch.h>
#include <stdlib.h>
#include <string.h>
+#include <assert.h>
#include <errno.h>
#include <ctype.h>
@@ -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);