return query_new();
}
+static bool config_refresh(void *config)
+{
+ return config_reload(config);
+}
+
static int postfix_parsejob(query_t *query, char *p)
{
#define PARSE_CHECK(expr, error, ...) \
const char *pidfile = NULL;
bool daemonize = true;
int port = DEFAULT_PORT;
+ bool port_from_cli = false;
for (int c = 0; (c = getopt(argc, argv, "hf" "l:p:")) >= 0; ) {
switch (c) {
break;
case 'l':
port = atoi(optarg);
+ port_from_cli = true;
break;
case 'f':
daemonize = false;
if (config == NULL) {
return EXIT_FAILURE;
}
+ if (port_from_cli || config->port == 0) {
+ config->port = port;
+ }
if (common_setup(pidfile, false, RUNAS_USER, RUNAS_GROUP,
daemonize) != EXIT_SUCCESS
- || start_listener(port) < 0) {
+ || start_listener(config->port) < 0) {
+ config_delete(&config);
return EXIT_FAILURE;
}
{
int res = server_loop(query_starter, (delete_client_t)query_delete,
- policy_run, NULL, config);
+ policy_run, config_refresh, config);
config_delete(&config);
return res;
}