dovecot-2.2: fs-posix: Code cleanup - don't store dir_mode perma...
dovecot at dovecot.org
dovecot at dovecot.org
Thu Nov 19 15:44:15 UTC 2015
details: http://hg.dovecot.org/dovecot-2.2/rev/4564f4300c91
changeset: 19402:4564f4300c91
user: Timo Sirainen <tss at iki.fi>
date: Thu Nov 19 17:19:19 2015 +0200
description:
fs-posix: Code cleanup - don't store dir_mode permanently.
Cleanup in preparation for mode=auto.
diffstat:
src/lib-fs/fs-posix.c | 15 +++++++++------
1 files changed, 9 insertions(+), 6 deletions(-)
diffs (44 lines):
diff -r db85dbd62706 -r 4564f4300c91 src/lib-fs/fs-posix.c
--- a/src/lib-fs/fs-posix.c Thu Nov 19 17:39:46 2015 +0200
+++ b/src/lib-fs/fs-posix.c Thu Nov 19 17:19:19 2015 +0200
@@ -33,7 +33,7 @@
char *temp_file_prefix, *root_path, *path_prefix;
unsigned int temp_file_prefix_len;
enum fs_posix_lock_method lock_method;
- mode_t mode, dir_mode;
+ mode_t mode;
};
struct posix_fs_file {
@@ -118,10 +118,6 @@
return -1;
}
}
- fs->dir_mode = fs->mode;
- if ((fs->dir_mode & 0600) != 0) fs->dir_mode |= 0100;
- if ((fs->dir_mode & 0060) != 0) fs->dir_mode |= 0010;
- if ((fs->dir_mode & 0006) != 0) fs->dir_mode |= 0001;
return 0;
}
@@ -147,12 +143,19 @@
static int fs_posix_mkdir_parents(struct posix_fs *fs, const char *path)
{
const char *dir, *fname;
+ mode_t dir_mode;
fname = strrchr(path, '/');
if (fname == NULL)
return 1;
+
+ dir_mode = fs->mode;
+ if ((dir_mode & 0600) != 0) dir_mode |= 0100;
+ if ((dir_mode & 0060) != 0) dir_mode |= 0010;
+ if ((dir_mode & 0006) != 0) dir_mode |= 0001;
+
dir = t_strdup_until(path, fname);
- if (mkdir_parents(dir, fs->dir_mode) == 0)
+ if (mkdir_parents(dir, dir_mode) == 0)
return 0;
else if (errno == EEXIST)
return 1;
More information about the dovecot-cvs
mailing list