Fix use of "options" broken by recent merging

This commit is contained in:
Greg Smith
2011-02-10 18:26:44 -05:00
parent b62ad056f1
commit 1be62fa6b2
5 changed files with 37 additions and 27 deletions

View File

@@ -34,10 +34,10 @@ parse_config(const char* config_file, t_configuration_options* options)
}
/* Initialize */
memset(config->cluster_name, 0, sizeof(config->cluster_name));
config->node = -1;
memset(config->conninfo, 0, sizeof(config->conninfo));
memset(config->rsync_options, 0, sizeof(config->rsync_options));
memset(options->cluster_name, 0, sizeof(options->cluster_name));
options->node = -1;
memset(options->conninfo, 0, sizeof(options->conninfo));
memset(options->rsync_options, 0, sizeof(options->rsync_options));
/* Read next line */
while ((s = fgets (buff, sizeof buff, fp)) != NULL)
@@ -51,14 +51,13 @@ parse_config(const char* config_file, t_configuration_options* options)
/* Copy into correct entry in parameters struct */
if (strcmp(name, "cluster") == 0)
strncpy (config->cluster_name, value, MAXLEN);
else if (strcmp(name, "node") == 0)
config->node = atoi(value);
else if (strcmp(name, "conninfo") == 0)
strncpy (config->conninfo, value, MAXLEN);
else if (strcmp(name, "rsync_options") == 0)
strncpy (config->rsync_options, value, QUERY_STR_LEN);
strncpy (options->cluster_name, value, MAXLEN);
else if (strcmp(name, "node") == 0)
options->node = atoi(value);
else if (strcmp(name, "conninfo") == 0)
strncpy (options->conninfo, value, MAXLEN);
else if (strcmp(name, "rsync_options") == 0)
strncpy (options->rsync_options, value, QUERY_STR_LEN);
else if (strcmp(name, "loglevel") == 0)
strncpy (options->loglevel, value, MAXLEN);
else if (strcmp(name, "logfacility") == 0)
@@ -71,14 +70,14 @@ parse_config(const char* config_file, t_configuration_options* options)
fclose (fp);
/* Check config settings */
if (strnlen(config->cluster_name, MAXLEN)==0)
if (strnlen(options->cluster_name, MAXLEN)==0)
{
fprintf(stderr, "Cluster name is missing. "
"Check the configuration file.\n");
exit(ERR_BAD_CONFIG);
}
if (config->node == -1)
if (options->node == -1)
{
fprintf(stderr, "Node information is missing. "
"Check the configuration file.\n");