]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib: file_create_locked() - Unexpectedly deleted temp file is error.
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Mon, 20 Jun 2016 14:52:28 +0000 (17:52 +0300)
committerTimo Sirainen <timo.sirainen@dovecot.fi>
Mon, 20 Jun 2016 15:03:38 +0000 (18:03 +0300)
This shouldn't happen and we shouldn't be silently retrying if it does.

src/lib/file-create-locked.c

index 3ea4c66b70359ab9dbaf4b3200e53cc86afc7730..905e8cdc01f583df92097cca91a4d2add5695bc8 100644 (file)
@@ -69,9 +69,11 @@ try_create_new(const char *path, const struct file_create_settings *set,
                        /* just created by somebody else */
                        ret = 0;
                } else if (errno == ENOENT) {
-                       /* our temp file was just deleted by somebody else,
-                          retry creating it. */
-                       ret = 0;
+                       /* nobody should be deleting the temp file unless the
+                          entire directory is deleted. */
+                       *error_r = t_strdup_printf(
+                               "Temporary file %s was unexpectedly deleted",
+                               str_c(temp_path));
                } else {
                        *error_r = t_strdup_printf("link(%s, %s) failed: %m",
                                                   str_c(temp_path), path);