changeset 22818:c4c14db5c639

lib-storage: Change mail_user_lock_file_create() to use mail_storage_lock_create()
author Timo Sirainen <timo.sirainen@dovecot.fi>
date Tue, 06 Feb 2018 17:49:15 +0200
parents ccd84e5bcf8c
children 698dedb5a026
files src/lib-storage/mail-user.c
diffstat 1 files changed, 2 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-storage/mail-user.c	Tue Feb 06 17:47:37 2018 +0200
+++ b/src/lib-storage/mail-user.c	Tue Feb 06 17:49:15 2018 +0200
@@ -503,8 +503,7 @@
 			       unsigned int lock_secs,
 			       struct file_lock **lock_r, const char **error_r)
 {
-	bool created;
-	const char *home, *path, *error;
+	const char *home, *path;
 	int ret;
 
 	if ((ret = mail_user_get_home(user, &home)) < 0) {
@@ -534,14 +533,7 @@
 				       lock_fname);
 		lock_set.mkdir_mode = 0700;
 	}
-
-	if (file_create_locked(path, &lock_set, lock_r, &created, &error) == -1) {
-		*error_r = t_strdup_printf("file_create_locked(%s) failed: %s", path, error);
-		return errno == EAGAIN ? 0 : -1;
-	}
-	file_lock_set_unlink_on_free(*lock_r, TRUE);
-	file_lock_set_close_on_free(*lock_r, TRUE);
-	return 1;
+	return mail_storage_lock_create(path, &lock_set, lock_r, error_r);
 }
 
 const char *mail_user_get_anvil_userip_ident(struct mail_user *user)