]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-fs: fs-posix - FS_METADATA_WRITE_FNAME replaces the full path
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Thu, 26 Apr 2018 15:14:27 +0000 (18:14 +0300)
committerTimo Sirainen <timo.sirainen@dovecot.fi>
Mon, 30 Apr 2018 13:06:22 +0000 (16:06 +0300)
This is how all the other fs drivers work, although the macro name is a bit
confusing.

src/lib-fs/fs-posix.c

index 5f834de51b6420375d32011865064bffb8ccbbe4..3c9550e9320a8750b04bbd144419e12104e6d206 100644 (file)
@@ -449,19 +449,14 @@ fs_posix_read_stream(struct fs_file *_file, size_t max_buffer_size)
 static void fs_posix_write_rename_if_needed(struct posix_fs_file *file)
 {
        struct posix_fs *fs = (struct posix_fs *)file->file.fs;
-       const char *new_fname, *new_prefix, *p;
+       const char *new_fname;
 
        new_fname = fs_metadata_find(&file->file.metadata, FS_METADATA_WRITE_FNAME);
        if (new_fname == NULL)
                return;
 
-       p = strrchr(file->file.path, '/');
-       if (p == NULL)
-               new_prefix = "";
-       else
-               new_prefix = t_strdup_until(file->file.path, p+1);
        i_free(file->file.path);
-       file->file.path = i_strconcat(new_prefix, new_fname, NULL);
+       file->file.path = i_strdup(new_fname);
 
        i_free(file->full_path);
        file->full_path = fs->path_prefix == NULL ? i_strdup(file->file.path) :