summaryrefslogtreecommitdiffstats
path: root/src/lib/safe-mkdir.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/safe-mkdir.h')
-rw-r--r--src/lib/safe-mkdir.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/lib/safe-mkdir.h b/src/lib/safe-mkdir.h
new file mode 100644
index 0000000..eb75fd1
--- /dev/null
+++ b/src/lib/safe-mkdir.h
@@ -0,0 +1,10 @@
+#ifndef SAFE_MKDIR_H
+#define SAFE_MKDIR_H
+
+/* Either create a directory or make sure that it already exists with given
+ permissions. If anything fails, the i_fatal() is called. Returns 1 if
+ directory was created, 2 if it already existed with correct permissions,
+ 0 if we changed permissions. */
+int safe_mkdir(const char *dir, mode_t mode, uid_t uid, gid_t gid);
+
+#endif