From: Timo Sirainen Date: Tue, 16 Jun 2009 00:49:27 +0000 (-0400) Subject: safe_mkstemp() was used incorrectly. umask() no longer changes its behavior. X-Git-Tag: 2.0.alpha1~576 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=5361187c0d8bb71feb8b084da90f901a4c934865;p=thirdparty%2Fdovecot%2Fcore.git safe_mkstemp() was used incorrectly. umask() no longer changes its behavior. --HG-- branch : HEAD --- diff --git a/src/lib/file-dotlock.c b/src/lib/file-dotlock.c index 6856d15cd2..cb32daffea 100644 --- a/src/lib/file-dotlock.c +++ b/src/lib/file-dotlock.c @@ -319,6 +319,7 @@ static int try_create_lock_hardlink(struct lock_info *lock_info, bool write_pid, { 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(struct lock_info *lock_info, bool write_pid, 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;