dovecot-2.1: dict file: Fixed assert-crash with fcntl/flock lock...

dovecot at dovecot.org dovecot at dovecot.org
Wed Apr 11 17:21:12 EEST 2012


details:   http://hg.dovecot.org/dovecot-2.1/rev/4fb683720a06
changeset: 14414:4fb683720a06
user:      Timo Sirainen <tss at iki.fi>
date:      Wed Apr 11 17:21:01 2012 +0300
description:
dict file: Fixed assert-crash with fcntl/flock lock method.

diffstat:

 src/lib-dict/dict-file.c |  10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diffs (29 lines):

diff -r 85966c47f172 -r 4fb683720a06 src/lib-dict/dict-file.c
--- a/src/lib-dict/dict-file.c	Wed Apr 11 15:02:53 2012 +0300
+++ b/src/lib-dict/dict-file.c	Wed Apr 11 17:21:01 2012 +0300
@@ -422,20 +422,20 @@
 static int
 file_dict_lock(struct file_dict *dict, struct file_lock **lock_r)
 {
-	int fd, ret;
+	int ret;
 
 	if (file_dict_open_latest(dict) < 0)
 		return -1;
 
 	if (dict->fd == -1) {
 		/* quota file doesn't exist yet, we need to create it */
-		fd = open(dict->path, O_CREAT | O_RDWR, 0600);
-		if (fd == -1) {
+		dict->fd = open(dict->path, O_CREAT | O_RDWR, 0600);
+		if (dict->fd == -1) {
 			i_error("creat(%s) failed: %m", dict->path);
 			return -1;
 		}
-		(void)fd_copy_parent_dir_permissions(dict->path, fd, dict->path);
-		(void)close(fd);
+		(void)fd_copy_parent_dir_permissions(dict->path, dict->fd,
+						     dict->path);
 	}
 
 	do {


More information about the dovecot-cvs mailing list