<p>Sean Bright has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/c/asterisk/+/19932">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">test_crypto.c: Fix getcwd(…) build error.<br><br>`getcwd(…)` is decorated with the `warn_unused_result` attribute and<br>therefore needs its return value checked.<br><br>Change-Id: Idcccb20a0abf293202c28633d0e9ee0f6a9dbe93<br>---<br>M tests/test_crypto.c<br>1 file changed, 40 insertions(+), 4 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/32/19932/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/tests/test_crypto.c b/tests/test_crypto.c</span><br><span>index 848a562..8b52c9d 100644</span><br><span>--- a/tests/test_crypto.c</span><br><span>+++ b/tests/test_crypto.c</span><br><span>@@ -110,10 +110,16 @@</span><br><span> </span><br><span>         if (!ast_check_command_in_path(command)) {</span><br><span>           ast_test_status_update(test, "couldn't find %s\n", command);</span><br><span style="color: hsl(120, 100%, 40%);">+            ast_test_capture_free(&cap);</span><br><span>             return res;</span><br><span>  }</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-   getcwd(wd, sizeof(wd));</span><br><span style="color: hsl(120, 100%, 40%);">+       if (getcwd(wd, sizeof(wd)) == NULL) {</span><br><span style="color: hsl(120, 100%, 40%);">+         ast_test_status_update(test, "Could not determine current working directory\n");</span><br><span style="color: hsl(120, 100%, 40%);">+            ast_test_capture_free(&cap);</span><br><span style="color: hsl(120, 100%, 40%);">+              return res;</span><br><span style="color: hsl(120, 100%, 40%);">+   }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span>  snprintf(key_dir, sizeof(key_dir), "%s/%s", wd, "tests/keys");</span><br><span>   push_key_dir((const char *)key_dir);</span><br><span>         snprintf(priv, sizeof(priv), "%s/%s.key", key_dir, keypair1);</span><br><span>@@ -200,10 +206,16 @@</span><br><span> </span><br><span>  if (!ast_check_command_in_path(command)) {</span><br><span>           ast_test_status_update(test, "couldn't find %s\n", command);</span><br><span style="color: hsl(120, 100%, 40%);">+            ast_test_capture_free(&cap);</span><br><span>             return res;</span><br><span>  }</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-   getcwd(wd, sizeof(wd));</span><br><span style="color: hsl(120, 100%, 40%);">+       if (getcwd(wd, sizeof(wd)) == NULL) {</span><br><span style="color: hsl(120, 100%, 40%);">+         ast_test_status_update(test, "Could not determine current working directory\n");</span><br><span style="color: hsl(120, 100%, 40%);">+            ast_test_capture_free(&cap);</span><br><span style="color: hsl(120, 100%, 40%);">+              return res;</span><br><span style="color: hsl(120, 100%, 40%);">+   }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span>  snprintf(key_dir, sizeof(key_dir), "%s/%s", wd, "tests/keys");</span><br><span>   push_key_dir((const char *)key_dir);</span><br><span>         snprintf(pub, sizeof(pub), "%s/%s.pub", key_dir, keypair1);</span><br><span>@@ -297,10 +309,16 @@</span><br><span> </span><br><span>    if (!ast_check_command_in_path(command)) {</span><br><span>           ast_test_status_update(test, "couldn't find %s\n", command);</span><br><span style="color: hsl(120, 100%, 40%);">+            ast_test_capture_free(&cap);</span><br><span>             return res;</span><br><span>  }</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-   getcwd(wd, sizeof(wd));</span><br><span style="color: hsl(120, 100%, 40%);">+       if (getcwd(wd, sizeof(wd)) == NULL) {</span><br><span style="color: hsl(120, 100%, 40%);">+         ast_test_status_update(test, "Could not determine current working directory\n");</span><br><span style="color: hsl(120, 100%, 40%);">+            ast_test_capture_free(&cap);</span><br><span style="color: hsl(120, 100%, 40%);">+              return res;</span><br><span style="color: hsl(120, 100%, 40%);">+   }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span>  snprintf(key_dir, sizeof(key_dir), "%s/%s", wd, "tests/keys");</span><br><span>   push_key_dir((const char *)key_dir);</span><br><span>         snprintf(pub, sizeof(pub), "%s/%s.pub", key_dir, keypair1);</span><br><span>@@ -410,10 +428,16 @@</span><br><span> </span><br><span>    if (!ast_check_command_in_path(command)) {</span><br><span>           ast_test_status_update(test, "couldn't find %s\n", command);</span><br><span style="color: hsl(120, 100%, 40%);">+            ast_test_capture_free(&cap);</span><br><span>             return res;</span><br><span>  }</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-   getcwd(wd, sizeof(wd));</span><br><span style="color: hsl(120, 100%, 40%);">+       if (getcwd(wd, sizeof(wd)) == NULL) {</span><br><span style="color: hsl(120, 100%, 40%);">+         ast_test_status_update(test, "Could not determine current working directory\n");</span><br><span style="color: hsl(120, 100%, 40%);">+            ast_test_capture_free(&cap);</span><br><span style="color: hsl(120, 100%, 40%);">+              return res;</span><br><span style="color: hsl(120, 100%, 40%);">+   }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span>  snprintf(key_dir, sizeof(key_dir), "%s/%s", wd, "tests/keys");</span><br><span>   push_key_dir((const char *)key_dir);</span><br><span>         snprintf(priv, sizeof(priv), "%s/%s.key", key_dir, keypair1);</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/c/asterisk/+/19932">change 19932</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/+/19932"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 18 </div>
<div style="display:none"> Gerrit-Change-Id: Idcccb20a0abf293202c28633d0e9ee0f6a9dbe93 </div>
<div style="display:none"> Gerrit-Change-Number: 19932 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Sean Bright <sean@seanbright.com> </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>