]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-storage: Another fix to mail storage initialization.
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Mon, 2 May 2016 21:25:43 +0000 (00:25 +0300)
committerAki Tuomi <aki.tuomi@dovecot.fi>
Tue, 11 Jul 2017 06:48:14 +0000 (09:48 +0300)
Allow mail_namespaces_init_location() to add the namespace directly to user,
since that's what the current callers always want. But compared to the
original code we're now calling mail_namespaces_init_finish() rather than
doing the same things ourself.

src/lib-storage/mail-namespace.c

index d8d296dd8b37b403f0bdfe41378062c6f5d89e08..c1a8f68eef02de032c78b9f8143a55b589ac75a1 100644 (file)
@@ -438,8 +438,7 @@ int mail_namespaces_init(struct mail_user *user, const char **error_r)
 
        if (namespaces == NULL) {
                /* no namespaces defined, create a default one */
-               if (mail_namespaces_init_location(user, NULL, error_r) < 0)
-                       return -1;
+               return mail_namespaces_init_location(user, NULL, error_r);
        }
        return mail_namespaces_init_finish(namespaces, error_r);
 }
@@ -517,7 +516,7 @@ int mail_namespaces_init_location(struct mail_user *user, const char *location,
                mail_namespace_free(ns);
                return -1;
        }
-       return 0;
+       return mail_namespaces_init_finish(ns, error_r);
 }
 
 struct mail_namespace *mail_namespaces_init_empty(struct mail_user *user)