dovecot-2.2: fs-posix: fs_copy() didn't work with prefix= parameter

dovecot at dovecot.org dovecot at dovecot.org
Mon Jun 15 21:19:16 UTC 2015


details:   http://hg.dovecot.org/dovecot-2.2/rev/5450f9217b97
changeset: 18861:5450f9217b97
user:      Timo Sirainen <tss at iki.fi>
date:      Tue Jun 16 00:16:42 2015 +0300
description:
fs-posix: fs_copy() didn't work with prefix= parameter

diffstat:

 src/lib-fs/fs-posix.c |  15 ++++++++-------
 1 files changed, 8 insertions(+), 7 deletions(-)

diffs (40 lines):

diff -r cac29b3a1e96 -r 5450f9217b97 src/lib-fs/fs-posix.c
--- a/src/lib-fs/fs-posix.c	Mon Jun 15 14:55:03 2015 +0300
+++ b/src/lib-fs/fs-posix.c	Tue Jun 16 00:16:42 2015 +0300
@@ -624,28 +624,29 @@
 
 static int fs_posix_copy(struct fs_file *_src, struct fs_file *_dest)
 {
+	struct posix_fs_file *src = (struct posix_fs_file *)_src;
 	struct posix_fs_file *dest = (struct posix_fs_file *)_dest;
 	struct posix_fs *fs = (struct posix_fs *)_src->fs;
 	unsigned int try_count = 0;
 	int ret;
 
-	ret = link(_src->path, _dest->path);
+	ret = link(src->full_path, dest->full_path);
 	if (errno == EEXIST && dest->open_mode == FS_OPEN_MODE_REPLACE) {
 		/* destination file already exists - replace it */
-		if (unlink(_dest->path) < 0 && errno != ENOENT)
-			i_error("unlink(%s) failed: %m", _dest->path);
-		ret = link(_src->path, _dest->path);
+		if (unlink(dest->full_path) < 0 && errno != ENOENT)
+			i_error("unlink(%s) failed: %m", dest->full_path);
+		ret = link(src->full_path, dest->full_path);
 	}
 	while (ret < 0 && errno == ENOENT &&
 	       try_count <= MAX_MKDIR_RETRY_COUNT) {
-		if (fs_posix_mkdir_parents(fs, _dest->path) < 0)
+		if (fs_posix_mkdir_parents(fs, dest->full_path) < 0)
 			return -1;
-		ret = link(_src->path, _dest->path);
+		ret = link(src->full_path, dest->full_path);
 		try_count++;
 	}
 	if (ret < 0) {
 		fs_set_error(_src->fs, "link(%s, %s) failed: %m",
-			     _src->path, _dest->path);
+			     src->full_path, dest->full_path);
 		return -1;
 	}
 	return 0;


More information about the dovecot-cvs mailing list