1 From f5617a4de54c313580fe39562f0d32e5c95f5212 Mon Sep 17 00:00:00 2001
2 From: rpm-build <rpm-build>
3 Date: Thu, 14 Sep 2017 01:05:53 +0200
4 Subject: [PATCH] Allow having both options and config file on command line
8 src/simpleconf.c | 23 +++++++++++++++++++++--
9 2 files changed, 22 insertions(+), 3 deletions(-)
11 diff --git a/src/ftpd.c b/src/ftpd.c
12 index c5edac5..b13afc0 100644
15 @@ -5589,7 +5589,7 @@ int pureftpd_start(int argc, char *argv[], const char *home_directory_)
19 - if (argc == 2 && *argv[1] != '-' &&
20 + if (argc >= 2 && *argv[1] != '-' &&
21 sc_build_command_line_from_file(argv[1], NULL, simpleconf_options,
22 (sizeof simpleconf_options) /
23 (sizeof simpleconf_options[0]),
24 diff --git a/src/simpleconf.c b/src/simpleconf.c
25 index f296f54..505aee1 100644
26 --- a/src/simpleconf.c
27 +++ b/src/simpleconf.c
28 @@ -674,9 +674,10 @@ sc_build_command_line_from_file(const char *file_name,
32 + char **argv_tmp = NULL;
38 if ((argv = malloc(sizeof *argv)) == NULL ||
39 (app_name = strdup(app_name)) == NULL) {
40 sc_argv_free(argc, argv);
41 @@ -689,6 +690,24 @@ sc_build_command_line_from_file(const char *file_name,
42 sc_argv_free(argc, argv);
46 + for (i = 2; i < *argc_p; ++i) {
48 + arg = strdup((*argv_p)[i]);
52 + if ((argv_tmp = realloc(argv, (sizeof arg) *
53 + ((size_t) argc + 1))) == NULL) {
57 + argv[argc - 1] = arg;