aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormmichelson <mmichelson@f38db490-d61c-443f-a65b-d21fe96a405b>2008-05-05 22:14:42 +0000
committermmichelson <mmichelson@f38db490-d61c-443f-a65b-d21fe96a405b>2008-05-05 22:14:42 +0000
commitd97369888b5acb51b7b8690edb909fbe6469ac81 (patch)
treea6288f04900ff258fe68e96c191380746d83c776
parentb9cbbea9739af1488dc147f3f5f82df4e43f25c6 (diff)
Merged revisions 115329 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk ........ r115329 | mmichelson | 2008-05-05 17:14:06 -0500 (Mon, 05 May 2008) | 15 lines #execing the same file multiple times led to warning messages saying that the same file was being #included twice. This was due to the fact that #exec created a temporary file which was then #included. The name of the temporary file was the name of the #exec'd file, with the Unix timestamp and thread ID concatenated. The issue was that if multiple #exec statements of the same file were reached in the same second, then the result was that the temporary files would have duplicate names. To resolve this, the temporary file now has microsecond resolution for the timestamp portion. (closes issue #12574) Reported by: jmls Patches: 12574.patch uploaded by putnopvut (license 60) Tested by: jmls, putnopvut ........ git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.6.0@115330 f38db490-d61c-443f-a65b-d21fe96a405b
-rw-r--r--main/config.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/main/config.c b/main/config.c
index 0c09cc8eb..db5167806 100644
--- a/main/config.c
+++ b/main/config.c
@@ -1056,9 +1056,10 @@ static int process_text_line(struct ast_config *cfg, struct ast_category **cat,
/* #exec </path/to/executable>
We create a tmp file, then we #include it, then we delete it. */
if (!do_include) {
+ struct timeval tv = ast_tvnow();
if (!ast_test_flag(&flags, CONFIG_FLAG_NOCACHE))
config_cache_attribute(configfile, ATTRIBUTE_EXEC, NULL, who_asked);
- snprintf(exec_file, sizeof(exec_file), "/var/tmp/exec.%d.%ld", (int)time(NULL), (long)pthread_self());
+ snprintf(exec_file, sizeof(exec_file), "/var/tmp/exec.%d%d.%ld", (int)tv.tv_sec, (int)tv.tv_usec, (long)pthread_self());
snprintf(cmd, sizeof(cmd), "%s > %s 2>&1", cur, exec_file);
ast_safe_system(cmd);
cur = exec_file;