From: Timo Sirainen Date: Tue, 29 Nov 2022 17:20:44 +0000 (+0200) Subject: lib-settings: Remove unused settings_parse_exec() X-Git-Tag: 2.4.0~3100 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7c27ebf777b56fc960233be166054f2bd31675c1;p=thirdparty%2Fdovecot%2Fcore.git lib-settings: Remove unused settings_parse_exec() --- diff --git a/src/lib-settings/settings-parser.c b/src/lib-settings/settings-parser.c index c06ef8fad4..cb7829a6bc 100644 --- a/src/lib-settings/settings-parser.c +++ b/src/lib-settings/settings-parser.c @@ -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) { diff --git a/src/lib-settings/settings-parser.h b/src/lib-settings/settings-parser.h index 865e39b54e..405c5fcfdf 100644 --- a/src/lib-settings/settings-parser.h +++ b/src/lib-settings/settings-parser.h @@ -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);