mirror of
https://github.com/asterisk/asterisk.git
synced 2025-11-19 00:00:09 +00:00
We shouldn't use a filename blindly without checking to make sure it's unused first
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@81430 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -235,12 +235,14 @@ struct ast_config_include *ast_include_new(struct ast_config *conf, const char *
|
|||||||
instances is possible, I'd have
|
instances is possible, I'd have
|
||||||
to create a new master for each instance. */
|
to create a new master for each instance. */
|
||||||
struct ast_config_include *inc;
|
struct ast_config_include *inc;
|
||||||
|
struct stat statbuf;
|
||||||
|
|
||||||
inc = ast_include_find(conf, included_file);
|
inc = ast_include_find(conf, included_file);
|
||||||
if (inc)
|
if (inc) {
|
||||||
{
|
do {
|
||||||
inc->inclusion_count++;
|
inc->inclusion_count++;
|
||||||
snprintf(real_included_file_name, real_included_file_name_size, "%s~~%d", included_file, inc->inclusion_count);
|
snprintf(real_included_file_name, real_included_file_name_size, "%s~~%d", included_file, inc->inclusion_count);
|
||||||
|
} while (stat(real_included_file_name, &statbuf) == 0);
|
||||||
ast_log(LOG_WARNING,"'%s', line %d: Same File included more than once! This data will be saved in %s if saved back to disk.\n", from_file, from_lineno, real_included_file_name);
|
ast_log(LOG_WARNING,"'%s', line %d: Same File included more than once! This data will be saved in %s if saved back to disk.\n", from_file, from_lineno, real_included_file_name);
|
||||||
} else
|
} else
|
||||||
*real_included_file_name = 0;
|
*real_included_file_name = 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user