Fix both app_read and underlying read issue (bug #2352)
authorMark Spencer <markster@digium.com>
Thu, 2 Sep 2004 13:52:58 +0000 (13:52 +0000)
committerMark Spencer <markster@digium.com>
Thu, 2 Sep 2004 13:52:58 +0000 (13:52 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@3711 65c4cc65-6c06-0410-ace0-fbb531ad65f3

app.c
apps/app_read.c

diff --git a/app.c b/app.c
index 86ad507..401b445 100755 (executable)
--- a/app.c
+++ b/app.c
@@ -37,6 +37,8 @@ int ast_app_getdata(struct ast_channel *c, char *prompt, char *s, int maxlen, in
 {
        int res,to,fto;
        /* XXX Merge with full version? XXX */
+       if (maxlen)
+               s[0] = '\0';
        if (prompt) {
                res = ast_streamfile(c, prompt, c->language);
                if (res < 0)
index 103e857..988ef80 100755 (executable)
@@ -103,9 +103,12 @@ static int read_exec(struct ast_channel *chan, void *data)
        if (!res) {
                ast_stopstream(chan);
                res = ast_app_getdata(chan, filename, tmp, maxdigits, 0);
-               if (res > -1)
+               if (res > -1) {
                        pbx_builtin_setvar_helper(chan, varname, tmp);
-               ast_verbose(VERBOSE_PREFIX_3 "User entered '%s'\n", tmp);
+                       ast_verbose(VERBOSE_PREFIX_3 "User entered '%s'\n", tmp);
+               } else {
+                       ast_verbose(VERBOSE_PREFIX_3 "User entered nothing\n");
+               }
        }
        LOCAL_USER_REMOVE(u);
        return res;