changeset 9476:d394cca843a9 HEAD

safe_mkstemp() was used incorrectly. umask() no longer changes its behavior.
author Timo Sirainen <tss@iki.fi>
date Mon, 15 Jun 2009 20:49:27 -0400
parents 73aea4432453
children 6462ba85d751
files src/lib/file-dotlock.c
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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 @@
 {
 	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 @@
 				    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;