<p>N A has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/c/asterisk/+/17484">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">app_read: Fix custom terminator functionality regression<br><br>Currently, when the t option is specified with no arguments,<br>the # character is still treated as a terminator, even though<br>no character should be treated as a terminator.<br><br>This is because a previous regression fix was modified to<br>remove the use of NULL as a default altogether. However,<br>NULL and an empty string actually refer to different<br>arrangements and should be treated differently. NULL is the<br>default terminator (#), while an empty string removes the<br>terminator altogether. This is the behavior being used by<br>the rest of the core.<br><br>Additionally, since S_OR catches empty strings as well as<br>NULL (not intended), this is changed to a ternary operator<br>instead, which fixes the behavior.<br><br>ASTERISK-29705 #close<br><br>Change-Id: I9b6b72196dd04f5b1e0ab5aa1b0adf627725e086<br>---<br>M apps/app_read.c<br>M main/app.c<br>2 files changed, 2 insertions(+), 2 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/84/17484/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/apps/app_read.c b/apps/app_read.c</span><br><span>index 977b20d..f4a965c 100644</span><br><span>--- a/apps/app_read.c</span><br><span>+++ b/apps/app_read.c</span><br><span>@@ -250,7 +250,7 @@</span><br><span>                                                break;</span><br><span>                                       }</span><br><span>                                    tmp[x++] = res;</span><br><span style="color: hsl(0, 100%, 40%);">-                                 if (strchr(terminator, tmp[x-1])) {</span><br><span style="color: hsl(120, 100%, 40%);">+                                   if (terminator && strchr(terminator, tmp[x-1])) {</span><br><span>                                            tmp[x-1] = '\0';</span><br><span>                                             status = "OK";</span><br><span>                                             break;</span><br><span>diff --git a/main/app.c b/main/app.c</span><br><span>index f5fbffd..411d507 100644</span><br><span>--- a/main/app.c</span><br><span>+++ b/main/app.c</span><br><span>@@ -249,7 +249,7 @@</span><br><span>                    fto = 50;</span><br><span>                    to = ast_channel_pbx(c) ? ast_channel_pbx(c)->dtimeoutms : 2000;</span><br><span>          }</span><br><span style="color: hsl(0, 100%, 40%);">-               res = ast_readstring(c, s, maxlen, to, fto, S_OR(terminator, "#"));</span><br><span style="color: hsl(120, 100%, 40%);">+         res = ast_readstring(c, s, maxlen, to, fto, (terminator ? terminator : "#"));</span><br><span>              if (res == AST_GETDATA_EMPTY_END_TERMINATED) {</span><br><span>                       return res;</span><br><span>          }</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/c/asterisk/+/17484">change 17484</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/c/asterisk/+/17484"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 16 </div>
<div style="display:none"> Gerrit-Change-Id: I9b6b72196dd04f5b1e0ab5aa1b0adf627725e086 </div>
<div style="display:none"> Gerrit-Change-Number: 17484 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: N A <mail@interlinked.x10host.com> </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>