]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-storage: Change mail_user_lock_file_create() to use mail_storage_lock_create()
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Tue, 6 Feb 2018 15:49:15 +0000 (17:49 +0200)
committerAki Tuomi <aki.tuomi@open-xchange.com>
Wed, 7 Feb 2018 08:50:28 +0000 (10:50 +0200)
src/lib-storage/mail-user.c

index 5f61db4c12c5d310b989a8f439226c3f4dd211ee..35985c4c8f9524723e2a53a733f5f81cc39b5e79 100644 (file)
@@ -566,8 +566,7 @@ int mail_user_lock_file_create(struct mail_user *user, const char *lock_fname,
                               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) {
@@ -597,14 +596,7 @@ int mail_user_lock_file_create(struct mail_user *user, const char *lock_fname,
                                       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)