summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2022-07-05 15:34:08 +0200
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2022-07-08 19:17:35 +0200
commitd6e2106e96b6969e045251d972e1adcceb9728df (patch)
tree6435792bf334cdd1980c071348348f697cf027cb /include
parent4a607edbdfc12f97da0810563fd2e699dcecaa71 (diff)
Cleanup: move filename_sane & canonicalize_path functions to libutil
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'include')
-rw-r--r--include/fstree.h19
-rw-r--r--include/util/util.h19
2 files changed, 19 insertions, 19 deletions
diff --git a/include/fstree.h b/include/fstree.h
index 3fb4f47..7bdbddf 100644
--- a/include/fstree.h
+++ b/include/fstree.h
@@ -237,25 +237,6 @@ tree_node_t *fstree_get_node_by_path(fstree_t *fs, tree_node_t *root,
bool stop_at_parent);
/*
- 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.
-*/
-int canonicalize_name(char *filename);
-
-/*
- Returns true if a given filename is sane, false if it is not (e.g. contains
- slashes or it is equal to '.' or '..').
-
- If check_os_specific is true, this also checks if the filename contains
- a character, or is equal to a name, that is black listed on the current OS.
- E.g. on Windows, a file named "COM0" or "AUX" is a no-no.
- */
-bool is_filename_sane(const char *name, bool check_os_specific);
-
-/*
Add a hard link node. Returns NULL on failure and sets errno.
*/
tree_node_t *fstree_add_hard_link(fstree_t *fs, const char *path,
diff --git a/include/util/util.h b/include/util/util.h
index af7d196..c18a558 100644
--- a/include/util/util.h
+++ b/include/util/util.h
@@ -43,4 +43,23 @@ SQFS_INTERNAL bool is_memory_zero(const void *blob, size_t size);
*/
SQFS_INTERNAL int mkdir_p(const char *path);
+/*
+ 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);
+
+/*
+ Returns true if a given filename is sane, false if it is not (e.g. contains
+ slashes or it is equal to '.' or '..').
+
+ If check_os_specific is true, this also checks if the filename contains
+ a character, or is equal to a name, that is black listed on the current OS.
+ E.g. on Windows, a file named "COM0" or "AUX" is a no-no.
+ */
+SQFS_INTERNAL bool is_filename_sane(const char *name, bool check_os_specific);
+
#endif /* SQFS_UTIL_H */