summaryrefslogtreecommitdiff
path: root/include/asterisk/utils.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/asterisk/utils.h')
-rw-r--r--include/asterisk/utils.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/include/asterisk/utils.h b/include/asterisk/utils.h
index ce6db0965..184850905 100644
--- a/include/asterisk/utils.h
+++ b/include/asterisk/utils.h
@@ -718,6 +718,19 @@ void ast_enable_packet_fragmentation(int sock);
*/
int ast_mkdir(const char *path, int mode);
+/*!
+ * \brief Recursively create directory path, but only if it resolves within
+ * the given \a base_path.
+ *
+ * If \a base_path does not exist, it will not be created and this function
+ * returns \c EPERM.
+ *
+ * \param path The directory path to create
+ * \param mode The permissions with which to try to create the directory
+ * \return 0 on success or an error code otherwise
+ */
+int ast_safe_mkdir(const char *base_path, const char *path, int mode);
+
#define ARRAY_LEN(a) (size_t) (sizeof(a) / sizeof(0[a]))