dovecot-2.0: safe_mkstemp() was used incorrectly. umask() no lon...
dovecot at dovecot.org
dovecot at dovecot.org
Tue Jun 16 03:49:35 EEST 2009
details: http://hg.dovecot.org/dovecot-2.0/rev/d394cca843a9
changeset: 9476:d394cca843a9
user: Timo Sirainen <tss at iki.fi>
date: Mon Jun 15 20:49:27 2009 -0400
description:
safe_mkstemp() was used incorrectly. umask() no longer changes its behavior.
diffstat:
1 file changed, 4 insertions(+), 1 deletion(-)
src/lib/file-dotlock.c | 5 ++++-
diffs (23 lines):
diff -r 73aea4432453 -r d394cca843a9 src/lib/file-dotlock.c
--- a/src/lib/file-dotlock.c Mon Jun 15 20:46:51 2009 -0400
+++ b/src/lib/file-dotlock.c Mon Jun 15 20:49:27 2009 -0400
@@ -319,6 +319,7 @@ static int try_create_lock_hardlink(stru
{
const char *temp_prefix = lock_info->set->temp_prefix;
const char *p;
+ mode_t old_mask;
if (lock_info->temp_path == NULL) {
/* we'll need our temp file first. */
@@ -346,8 +347,10 @@ static int try_create_lock_hardlink(stru
my_hostname, my_pid);
}
- lock_info->fd = safe_mkstemp(tmp_path, 0666,
+ old_mask = umask(0666);
+ lock_info->fd = safe_mkstemp(tmp_path, 0666 ^ old_mask,
(uid_t)-1, (gid_t)-1);
+ umask(old_mask);
if (lock_info->fd == -1)
return -1;
More information about the dovecot-cvs
mailing list