]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
sdbox: Fixed race condition when two processes mkdir() the same directory
authorTimo Sirainen <tss@iki.fi>
Mon, 6 Oct 2014 18:15:31 +0000 (21:15 +0300)
committerTimo Sirainen <tss@iki.fi>
Mon, 6 Oct 2014 18:15:31 +0000 (21:15 +0300)
src/lib-storage/index/dbox-single/sdbox-file.c

index 2862aabd45f0941610ea1222341d57d3855860f7..744cf7214a3e45aa4e09c02e4d8d36194599ef3c 100644 (file)
@@ -255,7 +255,8 @@ int sdbox_file_create_fd(struct dbox_file *file, const char *path, bool parents)
                dir = t_strdup_until(path, p);
                if (mkdir_parents_chgrp(dir, perm->dir_create_mode,
                                        perm->file_create_gid,
-                                       perm->file_create_gid_origin) < 0) {
+                                       perm->file_create_gid_origin) < 0 &&
+                  errno != EEXIST) {
                        mail_storage_set_critical(box->storage,
                                "mkdir_parents(%s) failed: %m", dir);
                        return -1;