]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
master: Use new var_expand
authorAki Tuomi <aki.tuomi@open-xchange.com>
Thu, 29 Aug 2024 11:26:15 +0000 (14:26 +0300)
committerAki Tuomi <aki.tuomi@open-xchange.com>
Fri, 17 Jan 2025 08:40:00 +0000 (10:40 +0200)
src/imap-hibernate/imap-client.c
src/master/service-process.c

index bd0cd75a7e9ee688a061d455e1bec85107cb8245..99771bc985103b625a968efaa4cf5c66f576f269 100644 (file)
@@ -657,7 +657,7 @@ imap_client_create(int fd, const struct imap_client_state *state)
                const struct var_expand_params params = {
                        .table = imap_client_get_var_expand_table(client),
                        .providers = funcs,
-                       .provider_context = fields,
+                       .context = fields,
                        .event = client->event,
                };
                string_t *str;
index 2d6b8dd9d7fd9f5251238780bdbf865f9b2c06bd..83c2937840da9eb94a9f7d3bf1c88b480f93b377 100644 (file)
@@ -17,7 +17,7 @@
 #include "restrict-access.h"
 #include "restrict-process-size.h"
 #include "eacces-error.h"
-#include "var-expand.h"
+#include "var-expand-new.h"
 #include "master-service.h"
 #include "master-service-settings.h"
 #include "dup2-array.h"
@@ -56,14 +56,15 @@ static int
 service_unix_pid_listener_get_path(struct service_listener *l, pid_t pid,
                                   string_t *path, const char **error_r)
 {
-       struct var_expand_table var_table[] = {
-               { '\0', dec2str(pid), "pid" },
-               { '\0', NULL, NULL },
+       const struct var_expand_params params = {
+               .table = (const struct var_expand_table[]) {
+                       { .key = "pid", .value = dec2str(pid) },
+                       VAR_EXPAND_TABLE_END
+               },
        };
 
        str_truncate(path, 0);
-       return var_expand_with_table(path, l->set.fileset.set->path, var_table,
-                                    error_r);
+       return var_expand_new(path, l->set.fileset.set->path, &params, error_r);
 }
 
 static void
@@ -153,7 +154,7 @@ service_dup_fds(struct service *service)
                array_foreach(&service->unix_pid_listeners, listenerp) {
                        l = *listenerp;
                        ret = service_unix_pid_listener_get_path(l, pid, path, &error);
-                       if (ret > 0) {
+                       if (ret == 0) {
                                ret = service_unix_listener_listen(l,
                                        str_c(path), FALSE, &error);
                        }
@@ -461,7 +462,7 @@ void service_process_destroy(struct service_process *process)
                array_foreach(&service->unix_pid_listeners, listenerp) {
                        str_truncate(path, 0);
                        if (service_unix_pid_listener_get_path(*listenerp,
-                                       process->pid, path, &error) > 0)
+                                       process->pid, path, &error) == 0)
                                i_unlink_if_exists(str_c(path));
                }
        }