diff options
author | markster <markster@f38db490-d61c-443f-a65b-d21fe96a405b> | 2003-09-10 05:24:49 +0000 |
---|---|---|
committer | markster <markster@f38db490-d61c-443f-a65b-d21fe96a405b> | 2003-09-10 05:24:49 +0000 |
commit | 976304e2d745787a11d40773e5e89bc1f5ed441e (patch) | |
tree | 7369fb6f917cb30c67faa951c0b0cdf29ff0eb73 | |
parent | 2d2f69d9b8a98aa5a4fb1247c5346becaed1793d (diff) |
Fix small logic errors (bug #242)
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@1494 f38db490-d61c-443f-a65b-d21fe96a405b
-rwxr-xr-x | apps/app_queue.c | 4 | ||||
-rwxr-xr-x | include/asterisk/cli.h | 3 | ||||
-rwxr-xr-x | pbx.c | 16 | ||||
-rwxr-xr-x | pbx/pbx_config.c | 2 | ||||
-rwxr-xr-x | res/res_monitor.c | 2 | ||||
-rwxr-xr-x | res/res_parking.c | 2 |
6 files changed, 18 insertions, 11 deletions
diff --git a/apps/app_queue.c b/apps/app_queue.c index 68d883c10..60afb6d23 100755 --- a/apps/app_queue.c +++ b/apps/app_queue.c @@ -1383,7 +1383,7 @@ static int queues_show(int fd, int argc, char **argv) pos = 1; ast_cli(fd, " Callers: \n"); for (qe = q->head; qe; qe = qe->next) - ast_cli(fd, " %d. %s (wait: %d:%02.2d)\n", pos++, qe->chan->name, + ast_cli(fd, " %d. %s (wait: %d:%2.2d)\n", pos++, qe->chan->name, (now - qe->start) / 60, (now - qe->start) % 60); } else ast_cli(fd, " No Callers\n"); @@ -1441,7 +1441,7 @@ static int manager_queues_status( struct mansession *s, struct message *m ) "Wait: %ld\r\n" "%s" "\r\n", - q->name, pos++, qe->chan->name, (qe->chan->callerid ? qe->chan->callerid : ""), now - qe->start), idText; + q->name, pos++, qe->chan->name, (qe->chan->callerid ? qe->chan->callerid : ""), (long)(now - qe->start), idText); ast_mutex_unlock(&q->lock); q = q->next; } diff --git a/include/asterisk/cli.h b/include/asterisk/cli.h index bb41ad8f3..6dfc62144 100755 --- a/include/asterisk/cli.h +++ b/include/asterisk/cli.h @@ -20,7 +20,8 @@ extern "C" { #include <stdarg.h> -extern void ast_cli(int fd, char *fmt, ...); +extern void ast_cli(int fd, char *fmt, ...) + __attribute__ ((format (printf, 2, 3))); #define RESULT_SUCCESS 0 #define RESULT_SHOWUSAGE 1 @@ -1134,7 +1134,7 @@ static int pbx_extension_helper(struct ast_channel *c, char *context, char *exte ast_mutex_unlock(&conlock); if (app) { if (c->context != context) - strncpy(c->context, context, sizeof(c->context-1)); + strncpy(c->context, context, sizeof(c->context)-1); if (c->exten != exten) strncpy(c->exten, exten, sizeof(c->exten)-1); c->priority = priority; @@ -2512,7 +2512,7 @@ static int handle_show_dialplan(int fd, int argc, char *argv[]) /* try to lock contexts */ if (ast_lock_contexts()) { - ast_cli(LOG_WARNING, "Failed to lock contexts list\n"); + ast_log(LOG_WARNING, "Failed to lock contexts list\n"); return RESULT_FAILURE; } @@ -3798,12 +3798,16 @@ int ast_pbx_outgoing_exten(char *type, int format, void *data, int timeout, char res = 0; if (option_verbose > 3) ast_verbose(VERBOSE_PREFIX_4 "Channel %s was answered.\n", chan->name); - if (context && strlen(context)) + if (context && *context) strncpy(chan->context, context, sizeof(chan->context) - 1); - if (exten && strlen(exten)) + if (exten && *exten) strncpy(chan->exten, exten, sizeof(chan->exten) - 1); - if (callerid && strlen(callerid)) - strncpy(chan->callerid, callerid, sizeof(chan->callerid) - 1); + if (callerid && *callerid) { + /* XXX call ast_set_callerid? */ + if (chan->callerid) + free(chan->callerid); + chan->callerid = strdup(callerid); + } if (priority > 0) chan->priority = priority; if (sync > 1) { diff --git a/pbx/pbx_config.c b/pbx/pbx_config.c index c6c6190fb..29a2039df 100755 --- a/pbx/pbx_config.c +++ b/pbx/pbx_config.c @@ -1334,7 +1334,7 @@ static int handle_context_remove_ignorepat(int fd, int argc, char *argv[]) break; default: - ast_cli(fd, "Failed to remove ignore pattern '%s' from '%s' context\n"); + ast_cli(fd, "Failed to remove ignore pattern '%s' from '%s' context\n", argv[2], argv[4]); break; } return RESULT_FAILURE; diff --git a/res/res_monitor.c b/res/res_monitor.c index 618c18701..38f737bc6 100755 --- a/res/res_monitor.c +++ b/res/res_monitor.c @@ -2,6 +2,8 @@ #include <stdlib.h> #include <errno.h> #include <string.h> +#include <sys/types.h> +#include <sys/stat.h> #include <asterisk/lock.h> #include <asterisk/channel.h> diff --git a/res/res_parking.c b/res/res_parking.c index 828be881b..ada9723fe 100755 --- a/res/res_parking.c +++ b/res/res_parking.c @@ -582,7 +582,7 @@ static int handle_parkedcalls(int fd, int argc, char *argv[]) cur=parkinglot; while(cur) { - ast_cli(fd, "%4d %25s (%-15s %-12s %-4d) %6ds\n" + ast_cli(fd, "%4d %25s (%-15s %-12s %-4d) %6lds\n" ,cur->parkingnum, cur->chan->name, cur->context, cur->exten ,cur->priority, cur->start.tv_sec + (cur->parkingtime/1000) - time(NULL)); |