From: Timo Sirainen Date: Tue, 24 Apr 2018 15:50:38 +0000 (+0300) Subject: dsync: If lock file can't be created because home is missing, mkdir the home X-Git-Tag: 2.2.36.rc1~28 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=6a38ed970ff7a742c87f29a9f227690029d1eba3;p=thirdparty%2Fdovecot%2Fcore.git dsync: If lock file can't be created because home is missing, mkdir the home --- diff --git a/src/doveadm/dsync/dsync-brain.c b/src/doveadm/dsync/dsync-brain.c index ec75a0e75e..b2c2b33ae3 100644 --- a/src/doveadm/dsync/dsync-brain.c +++ b/src/doveadm/dsync/dsync-brain.c @@ -442,6 +442,13 @@ dsync_brain_lock(struct dsync_brain *brain, const char *remote_hostname) "/"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) {