aboutsummaryrefslogtreecommitdiffstats
path: root/config.c
diff options
context:
space:
mode:
authorkpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b>2006-12-12 22:58:49 +0000
committerkpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b>2006-12-12 22:58:49 +0000
commit41df2e668668137091861464cabe91cf110f4302 (patch)
tree921cb941ba1a59df6cc1650b935d249fa0b73f84 /config.c
parent476ed07a1111e6172eb4f860ad239d3ef7bb5f49 (diff)
manual update, since automerge is not running at this time
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.2-netsec@48421 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'config.c')
-rw-r--r--config.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/config.c b/config.c
index b35045427..989cd0b15 100644
--- a/config.c
+++ b/config.c
@@ -120,6 +120,8 @@ void ast_variable_append(struct ast_category *category, struct ast_variable *var
else
category->root = variable;
category->last = variable;
+ while (category->last->next)
+ category->last = category->last->next;
}
void ast_variables_destroy(struct ast_variable *v)
@@ -301,6 +303,7 @@ struct ast_variable *ast_category_detach_variables(struct ast_category *cat)
v = cat->root;
cat->root = NULL;
+ cat->last = NULL;
return v;
}
@@ -698,10 +701,13 @@ int config_text_file_save(const char *configfile, const struct ast_config *cfg,
if ((f = fopen(fn, "w"))) {
#endif
if (option_verbose > 1)
- ast_verbose( VERBOSE_PREFIX_2 "Saving '%s': ", fn);
+ ast_verbose(VERBOSE_PREFIX_2 "Saving '%s': ", fn);
fprintf(f, ";!\n");
fprintf(f, ";! Automatically generated configuration file\n");
- fprintf(f, ";! Filename: %s (%s)\n", configfile, fn);
+ if (strcmp(configfile, fn))
+ fprintf(f, ";! Filename: %s (%s)\n", configfile, fn);
+ else
+ fprintf(f, ";! Filename: %s\n", configfile);
fprintf(f, ";! Generator: %s\n", generator);
fprintf(f, ";! Creation Date: %s", date);
fprintf(f, ";!\n");
@@ -731,9 +737,9 @@ int config_text_file_save(const char *configfile, const struct ast_config *cfg,
}
} else {
if (option_debug)
- printf("Unable to open for writing: %s\n", fn);
+ ast_log(LOG_DEBUG, "Unable to open for writing: %s\n", fn);
if (option_verbose > 1)
- printf( "Unable to write (%s)", strerror(errno));
+ ast_verbose(VERBOSE_PREFIX_2 "Unable to write (%s)", strerror(errno));
return -1;
}
fclose(f);