<p style="white-space: pre-wrap; word-wrap: break-word;">I have a new patchset almost ready. I also modified the common function to report errors, and check if it can allocate the new variable BEFORE discarding the old one.</p><p style="white-space: pre-wrap; word-wrap: break-word;">I wait instruction regarding chan_dahdi.</p><p><a href="https://gerrit.asterisk.org/c/asterisk/+/10930">View Change</a></p><p>3 comments:</p><ul style="list-style: none; padding: 0;"><li style="margin: 0; padding: 0;"><p><a href="https://gerrit.asterisk.org/#/c/10930/6//COMMIT_MSG">Commit Message:</a></p><ul style="list-style: none; padding: 0;"><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.asterisk.org/#/c/10930/6//COMMIT_MSG@14">Patch Set #6, Line 14:</a> </p><p><blockquote style="border-left: 1px solid #aaa; margin: 10px 0; padding: 0 10px;"><pre style="font-family: monospace,monospace; white-space: pre-wrap;">This change makes the code replace the old value with the new<br>one. The chan_dahdi driver already conforms to this, more logical,<br>behavior.<br></pre></blockquote></p><p><blockquote style="border-left: 1px solid #aaa; margin: 10px 0; padding: 0 10px;">Can you point out where in chan_dahdi this logic is similar?</blockquote></p><p style="white-space: pre-wrap; word-wrap: break-word;">In the bug report I started from there's a comment stating that there is a patch that fixed this for chan_dahdi, I actually took it for good without checking. My fault.</p><p style="white-space: pre-wrap; word-wrap: break-word;">I can't actually find any code in chan_dahdi for this.</p><p style="white-space: pre-wrap; word-wrap: break-word;">I can apply the same generic function in chan_dahdi too now, if it's ok, I'm unable to test that in any way though.</p><p style="white-space: pre-wrap; word-wrap: break-word;">Should I apply the generic function to chan_dahdi too?</p></li></ul></li><li style="margin: 0; padding: 0;"><p><a href="https://gerrit.asterisk.org/#/c/10930/2/channels/chan_iax2.c">File channels/chan_iax2.c:</a></p><ul style="list-style: none; padding: 0;"><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.asterisk.org/#/c/10930/2/channels/chan_iax2.c@13051">Patch Set #2, Line 13051:</a> </p><p><blockquote style="border-left: 1px solid #aaa; margin: 10px 0; padding: 0 10px;"><pre style="font-family: monospace,monospace; white-space: pre-wrap;">                   } else if (!strcasecmp(v->name, "setvar")) {<br>                             char *varname = ast_strdupa(v->value);<br>                             char *varval;<br>                         if ((varval = strchr(varname, '='))) {<br>                                        *varval++ = '\0';<br>                                     for (cur = peer->vars; cur; prev = cur, cur = cur->next) {<br>                                              if(!strcmp(varname, cur->name)) {<br>                                                  /* for duplicate entries use last in the user */<br>                                                      if(prev == NULL)<br>                                                              peer->vars = cur->next;<br>                                                 else<br>                                                          prev->next = cur->next;<br>                                                 ast_free(cur);<br><br>                                                      break;<br>                                                }<br>                                     }<br>                                     if((tmpvar = ast_variable_new(varname, varval, ""))) {<br>                                              tmpvar->next = peer->vars;<br>                                              peer->vars = tmpvar;<br>                                       }<br>                             }<br></pre></blockquote></p><p><blockquote style="border-left: 1px solid #aaa; margin: 10px 0; padding: 0 10px;">Unless I'm mistaken "setvar" was not valid for peers previously, only for users. […]</blockquote></p><p style="white-space: pre-wrap; word-wrap: break-word;">Ack, next patch set will fix this.</p></li><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.asterisk.org/#/c/10930/2/channels/chan_iax2.c@13217">Patch Set #2, Line 13217:</a> </p><p><blockquote style="border-left: 1px solid #aaa; margin: 10px 0; padding: 0 10px;"><pre style="font-family: monospace,monospace; white-space: pre-wrap;">                                 for (cur = user->vars; cur; prev = cur, cur = cur->next) {<br>                                              if(!strcmp(varname, cur->name)) {<br>                                                  /* for duplicate entries use last in the user */<br>                                                      if(prev == NULL)<br>                                                              user->vars = cur->next;<br>                                                 else<br>                                                          prev->next = cur->next;<br><br>                                                       ast_free(cur);<br>                                                        break;<br>                                                }<br>                                     }<br></pre></blockquote></p><p><blockquote style="border-left: 1px solid #aaa; margin: 10px 0; padding: 0 10px;">Agree. Will be working on this.</blockquote></p><p style="white-space: pre-wrap; word-wrap: break-word;">Ack, next patch set will fix this.</p></li></ul></li></ul><p>To view, visit <a href="https://gerrit.asterisk.org/c/asterisk/+/10930">change 10930</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/+/10930"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-Change-Id: Ie1897a96c82b8945e752733612ee963686f32839 </div>
<div style="display:none"> Gerrit-Change-Number: 10930 </div>
<div style="display:none"> Gerrit-PatchSet: 6 </div>
<div style="display:none"> Gerrit-Owner: Guido Falsi <madpilot@freebsd.org> </div>
<div style="display:none"> Gerrit-Reviewer: Friendly Automation </div>
<div style="display:none"> Gerrit-Reviewer: George Joseph <gjoseph@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Guido Falsi <madpilot@freebsd.org> </div>
<div style="display:none"> Gerrit-Reviewer: Joshua C. Colp <jcolp@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Sean Bright <sean.bright@gmail.com> </div>
<div style="display:none"> Gerrit-Comment-Date: Thu, 14 Mar 2019 18:31:59 +0000 </div>
<div style="display:none"> Gerrit-HasComments: Yes </div>
<div style="display:none"> Gerrit-Has-Labels: No </div>
<div style="display:none"> Comment-In-Reply-To: Sean Bright <sean.bright@gmail.com> </div>
<div style="display:none"> Comment-In-Reply-To: Joshua C. Colp <jcolp@digium.com> </div>
<div style="display:none"> Comment-In-Reply-To: Guido Falsi <madpilot@freebsd.org> </div>
<div style="display:none"> Gerrit-MessageType: comment </div>