Mercurial > dovecot > core-2.2
changeset 22920:02aed723d139
dsync: If lock file can't be created because home is missing, mkdir the home
author | Timo Sirainen <timo.sirainen@dovecot.fi> |
---|---|
date | Tue, 24 Apr 2018 18:50:38 +0300 |
parents | 2b16e07f8312 |
children | 9899d141ec9e |
files | src/doveadm/dsync/dsync-brain.c |
diffstat | 1 files changed, 7 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/doveadm/dsync/dsync-brain.c Tue Apr 24 18:47:28 2018 +0300 +++ b/src/doveadm/dsync/dsync-brain.c Tue Apr 24 18:50:38 2018 +0300 @@ -442,6 +442,13 @@ "/"DSYNC_LOCK_FILENAME, NULL); brain->lock_fd = file_create_locked(brain->lock_path, &lock_set, &brain->lock, &created, &error); + if (brain->lock_fd == -1 && errno == ENOENT) { + /* home directory not created */ + if (mail_user_home_mkdir(brain->user) < 0) + return -1; + brain->lock_fd = file_create_locked(brain->lock_path, &lock_set, + &brain->lock, &created, &error); + } if (brain->lock_fd == -1) i_error("Couldn't lock %s: %s", brain->lock_path, error); else if (brain->debug) {