[Asterisk-cvs] asterisk asterisk.c,1.42,1.43 pbx.c,1.90,1.91
markster at lists.digium.com
markster at lists.digium.com
Sun Nov 30 20:20:55 CST 2003
Update of /usr/cvsroot/asterisk
In directory mongoose.digium.com:/tmp/cvs-serv2195
Modified Files:
asterisk.c pbx.c
Log Message:
Add ${TIMESTAMP} (bug #607) and don't ever ast_log from within handler
Index: asterisk.c
===================================================================
RCS file: /usr/cvsroot/asterisk/asterisk.c,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -d -r1.42 -r1.43
--- asterisk.c 9 Nov 2003 20:31:54 -0000 1.42
+++ asterisk.c 1 Dec 2003 02:47:19 -0000 1.43
@@ -333,8 +333,9 @@
{
/* Called by soft_hangup to interrupt the select, read, or other
system call. We don't actually need to do anything though. */
+ /* Cannot EVER ast_log from within a signal handler */
if (option_debug)
- ast_log(LOG_DEBUG, "Urgent handler\n");
+ printf("Urgent handler\n");
signal(num, urg_handler);
return;
}
@@ -342,12 +343,14 @@
static void hup_handler(int num)
{
if (option_verbose > 1)
- ast_verbose(VERBOSE_PREFIX_2 "Received HUP signal -- Reloading configs\n");
+ printf("Received HUP signal -- Reloading configs\n");
+ /* XXX This could deadlock XXX */
ast_module_reload();
}
static void child_handler(int sig)
{
+ /* Must not ever ast_log or ast_verbose within signal handler */
int n, status;
/*
@@ -356,7 +359,7 @@
for (n = 0; wait4(-1, &status, WNOHANG, NULL) > 0; n++)
;
if (n == 0 && option_debug)
- ast_log(LOG_DEBUG, "Huh? Child handler, but nobody there?\n");
+ printf("Huh? Child handler, but nobody there?\n");
}
static void set_title(char *text)
Index: pbx.c
===================================================================
RCS file: /usr/cvsroot/asterisk/pbx.c,v
retrieving revision 1.90
retrieving revision 1.91
diff -u -d -r1.90 -r1.91
--- pbx.c 24 Nov 2003 03:43:14 -0000 1.90
+++ pbx.c 1 Dec 2003 02:47:19 -0000 1.91
@@ -859,6 +859,19 @@
brokentime.tm_sec
);
*ret = workspace;
+ } else if (c && !strcmp(var, "TIMESTAMP")) {
+ thistime=time(NULL);
+ localtime_r(&thistime, &brokentime);
+ /* 20031130-150612 */
+ snprintf(workspace, workspacelen -1, "%04d%02d%02d-%02d%02d%02d",
+ brokentime.tm_year+1900,
+ brokentime.tm_mon+1,
+ brokentime.tm_mday,
+ brokentime.tm_hour,
+ brokentime.tm_min,
+ brokentime.tm_sec
+ );
+ *ret = workspace;
} else if (c && !strcmp(var, "UNIQUEID")) {
snprintf(workspace, workspacelen -1, "%s", c->uniqueid);
*ret = workspace;
More information about the svn-commits
mailing list