diff options
author | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2019-09-19 23:51:03 +0200 |
---|---|---|
committer | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2019-09-20 03:57:32 +0200 |
commit | 5dcd267e9f0c5d93793e6d5e68279bd5dde5dff6 (patch) | |
tree | 6e45f14cce5b468c2f9b23d7921acff60bd27eb0 /include/util.h | |
parent | 336a05a544ea8773653faa9a9d5078afaa839ff2 (diff) |
Move canonicalize_name back to libutil
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'include/util.h')
-rw-r--r-- | include/util.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/include/util.h b/include/util.h index 5fb5f9b..26c54e2 100644 --- a/include/util.h +++ b/include/util.h @@ -123,4 +123,13 @@ void *alloc_array(size_t item_size, size_t nmemb); SQFS_INTERNAL void *alloc_string(size_t len); +/* + Convert back to forward slashed, remove all preceeding and trailing slashes, + collapse all sequences of slashes, remove all path components that are '.' + and returns failure state if one of the path components is '..'. + + Returns 0 on success. +*/ +SQFS_INTERNAL int canonicalize_name(char *filename); + #endif /* UTIL_H */ |