]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-settings: Remove unused settings_parse_exec()
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Tue, 29 Nov 2022 17:20:44 +0000 (19:20 +0200)
committeraki.tuomi <aki.tuomi@open-xchange.com>
Fri, 27 Jan 2023 13:01:47 +0000 (13:01 +0000)
src/lib-settings/settings-parser.c
src/lib-settings/settings-parser.h

index c06ef8fad42cfac4d3c33e51d364a072e760f4bc..cb7829a6bc8f77ea3e036246b0a4e4aba75f1437 100644 (file)
@@ -978,60 +978,6 @@ int settings_parse_environ(struct setting_parser_context *ctx)
        return ret;
 }
 
-int settings_parse_exec(struct setting_parser_context *ctx,
-                       const char *bin_path, const char *config_path,
-                       const char *service)
-{
-       struct istream *input;
-       pid_t pid;
-       int ret, fd[2], status;
-
-       if (pipe(fd) < 0) {
-               i_error("pipe() failed: %m");
-               return -1;
-       }
-
-       pid = fork();
-       if (pid == (pid_t)-1) {
-               i_error("fork() failed: %m");
-               i_close_fd(&fd[0]);
-               i_close_fd(&fd[1]);
-               return -1;
-       }
-       if (pid == 0) {
-               /* child */
-               static const char *argv[] = {
-                       NULL,
-                       "-c", NULL,
-                       "-p", NULL,
-                       NULL
-               };
-               argv[0] = bin_path;
-               argv[2] = config_path;
-               argv[4] = service;
-               i_close_fd(&fd[0]);
-               if (dup2(fd[1], STDOUT_FILENO) < 0)
-                       i_fatal("dup2() failed: %m");
-
-               execv_const(argv[0], argv);
-       }
-       i_close_fd(&fd[1]);
-
-       input = i_stream_create_fd_autoclose(&fd[0], SIZE_MAX);
-       i_stream_set_name(input, bin_path);
-       ret = settings_parse_stream_read(ctx, input);
-       i_stream_destroy(&input);
-
-       if (waitpid(pid, &status, 0) < 0) {
-               i_error("waitpid() failed: %m");
-               ret = -1;
-       } else if (status != 0) {
-               i_error("%s returned failure: %d", bin_path, status);
-               ret = -1;
-       }
-       return ret;
-}
-
 bool settings_check(const struct setting_parser_info *info, pool_t pool,
                    void *set, const char **error_r)
 {
index 865e39b54e110e6ec3482b976684a6c0d3da89be..405c5fcfdff9f9bd64091da37ddb9232a62d1f91 100644 (file)
@@ -188,10 +188,6 @@ int settings_parse_stream_read(struct setting_parser_context *ctx,
 int settings_parse_file(struct setting_parser_context *ctx,
                        const char *path, size_t max_line_length);
 int settings_parse_environ(struct setting_parser_context *ctx);
-/* Execute the given binary and wait for it to return the configuration. */
-int settings_parse_exec(struct setting_parser_context *ctx,
-                       const char *bin_path, const char *config_path,
-                       const char *service);
 /* Call all check_func()s to see if currently parsed settings are valid. */
 bool settings_parser_check(struct setting_parser_context *ctx, pool_t pool,
                           const char **error_r);