Makes get_dir_mode() from src/lib-sieve/mailbox-list.c public.
#include <fcntl.h>
#include <unistd.h>
+mode_t mkdir_get_executable_mode(mode_t mode)
+{
+ /* add the execute bit if either read or write bit is set */
+ if ((mode & 0600) != 0) mode |= 0100;
+ if ((mode & 0060) != 0) mode |= 0010;
+ if ((mode & 0006) != 0) mode |= 0001;
+ return mode;
+}
+
static int ATTR_NULL(5)
mkdir_chown_full(const char *path, mode_t mode, uid_t uid,
gid_t gid, const char *gid_origin)
#include <sys/stat.h>
+/* Returns the mode with executable bit added for each read/write bit. For
+ example mode=0640 returns 0750. */
+mode_t mkdir_get_executable_mode(mode_t mode);
+
/* Create path and all the directories under it if needed. Permissions for
existing directories isn't changed. Returns 0 if ok. If directory already
exists, returns -1 with errno=EEXIST. */