]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
safe_mkstemp() was used incorrectly. umask() no longer changes its behavior.
authorTimo Sirainen <tss@iki.fi>
Tue, 16 Jun 2009 00:49:27 +0000 (20:49 -0400)
committerTimo Sirainen <tss@iki.fi>
Tue, 16 Jun 2009 00:49:27 +0000 (20:49 -0400)
--HG--
branch : HEAD

src/lib/file-dotlock.c

index 6856d15cd2ba730880f313528335d5a37e50186d..cb32daffea86f06ddbc153eb130ffe59f146e650 100644 (file)
@@ -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;