aboutsummaryrefslogtreecommitdiffstats
path: root/main/channel.c
diff options
context:
space:
mode:
Diffstat (limited to 'main/channel.c')
-rw-r--r--main/channel.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/main/channel.c b/main/channel.c
index d788e79a2..e7b2c8626 100644
--- a/main/channel.c
+++ b/main/channel.c
@@ -3692,20 +3692,25 @@ int ast_readstring_full(struct ast_channel *c, char *s, int len, int timeout, in
d = ast_waitfordigit_full(c, to, audiofd, ctrlfd);
}
if (d < 0)
- return -1;
+ return AST_GETDATA_FAILED;
if (d == 0) {
- s[pos]='\0';
- return 1;
+ s[pos] = '\0';
+ return AST_GETDATA_TIMEOUT;
}
if (d == 1) {
- s[pos]='\0';
- return 2;
+ s[pos] = '\0';
+ return AST_GETDATA_INTERRUPTED;
+ }
+ if (strchr(enders, d) && (pos == 0)) {
+ s[pos] = '\0';
+ return AST_GETDATA_EMPTY_END_TERMINATED;
}
- if (!strchr(enders, d))
+ if (!strchr(enders, d)) {
s[pos++] = d;
+ }
if (strchr(enders, d) || (pos >= len)) {
- s[pos]='\0';
- return 0;
+ s[pos] = '\0';
+ return AST_GETDATA_COMPLETE;
}
to = timeout;
}