[asterisk-commits] tilghman: branch 1.6.0 r167904 - in /branches/1.6.0: ./ res/res_agi.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Thu Jan 8 16:42:24 CST 2009
Author: tilghman
Date: Thu Jan 8 16:42:23 2009
New Revision: 167904
URL: http://svn.digium.com/view/asterisk?view=rev&rev=167904
Log:
Merged revisions 167894 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk
................
r167894 | tilghman | 2009-01-08 16:37:20 -0600 (Thu, 08 Jan 2009) | 13 lines
Merged revisions 167840 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r167840 | tilghman | 2009-01-08 16:08:56 -0600 (Thu, 08 Jan 2009) | 6 lines
Don't truncate database results at 255 chars.
(closes issue #14069)
Reported by: evandro
Patches:
20081214__bug14069.diff.txt uploaded by Corydon76 (license 14)
........
................
Modified:
branches/1.6.0/ (props changed)
branches/1.6.0/res/res_agi.c
Propchange: branches/1.6.0/
------------------------------------------------------------------------------
Binary property 'trunk-merged' - no diff available.
Modified: branches/1.6.0/res/res_agi.c
URL: http://svn.digium.com/view/asterisk/branches/1.6.0/res/res_agi.c?view=diff&rev=167904&r1=167903&r2=167904
==============================================================================
--- branches/1.6.0/res/res_agi.c (original)
+++ branches/1.6.0/res/res_agi.c Thu Jan 8 16:42:23 2009
@@ -1619,16 +1619,32 @@
static int handle_dbget(struct ast_channel *chan, AGI *agi, int argc, char **argv)
{
int res;
- char tmp[256];
+ struct ast_str *buf;
if (argc != 4)
return RESULT_SHOWUSAGE;
- res = ast_db_get(argv[2], argv[3], tmp, sizeof(tmp));
+
+ if (!(buf = ast_str_create(16))) {
+ ast_agi_send(agi->fd, chan, "200 result=-1\n");
+ return RESULT_SUCCESS;
+ }
+
+ do {
+ res = ast_db_get(argv[2], argv[3], buf->str, buf->len);
+ if (buf->used < buf->len - 1) {
+ break;
+ }
+ if (ast_str_make_space(&buf, buf->len * 2)) {
+ break;
+ }
+ } while (1);
+
if (res)
ast_agi_send(agi->fd, chan, "200 result=0\n");
else
- ast_agi_send(agi->fd, chan, "200 result=1 (%s)\n", tmp);
-
+ ast_agi_send(agi->fd, chan, "200 result=1 (%s)\n", buf->str);
+
+ ast_free(buf);
return RESULT_SUCCESS;
}
More information about the asterisk-commits
mailing list