# HG changeset patch # User Timo Sirainen # Date 1524755667 -10800 # Node ID c7d47a5c55505340895e91d50c2113b95df46e6a # Parent 828152a256d60fbcc6e3de5dc75536f81a4d2ab5 lib-fs: fs-posix - FS_METADATA_WRITE_FNAME replaces the full path This is how all the other fs drivers work, although the macro name is a bit confusing. diff -r 828152a256d6 -r c7d47a5c5550 src/lib-fs/fs-posix.c --- a/src/lib-fs/fs-posix.c Thu Apr 26 18:14:46 2018 +0300 +++ b/src/lib-fs/fs-posix.c Thu Apr 26 18:14:27 2018 +0300 @@ -449,19 +449,14 @@ 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) :