]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
fs-posix: Autodelete directories also when "prefix" parameter is used.
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Tue, 21 Jun 2016 13:49:19 +0000 (16:49 +0300)
committerTimo Sirainen <timo.sirainen@dovecot.fi>
Tue, 21 Jun 2016 14:24:47 +0000 (17:24 +0300)
src/lib-fs/fs-posix.c

index de9f43ead75121a945de270421100ee93272337f..3090f0d3405b83c0ba6e9994b3f4ff545195a5a6 100644 (file)
@@ -201,12 +201,13 @@ static int fs_posix_rmdir_parents(struct posix_fs *fs, const char *path)
 {
        const char *p;
 
-       if (fs->root_path == NULL)
+       if (fs->root_path == NULL && fs->path_prefix == NULL)
                return 0;
 
        while ((p = strrchr(path, '/')) != NULL) {
                path = t_strdup_until(path, p);
-               if (strcmp(path, fs->root_path) == 0)
+               if ((fs->root_path != NULL && strcmp(path, fs->root_path) == 0) ||
+                   (fs->path_prefix != NULL && strncmp(path, fs->path_prefix, strlen(path)) == 0))
                        break;
                if (rmdir(path) == 0) {
                        /* success, continue to parent */