guile-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Guile-commits] 06/58: Make sure the return value of 'scm_crypt' is alwa


From: Andy Wingo
Subject: [Guile-commits] 06/58: Make sure the return value of 'scm_crypt' is always initialized.
Date: Tue, 7 Aug 2018 06:58:29 -0400 (EDT)

wingo pushed a commit to branch lightning
in repository guile.

commit 921364df27423a2979dcd40481bcb65736148368
Author: Ludovic Courtès <address@hidden>
Date:   Wed Jan 10 16:19:09 2018 +0100

    Make sure the return value of 'scm_crypt' is always initialized.
    
    * libguile/posix.c (scm_crypt): Always initialize 'ret'; error out even
    when ERR is zero.
---
 libguile/posix.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/libguile/posix.c b/libguile/posix.c
index b35dfbd..2e3fed6 100644
--- a/libguile/posix.c
+++ b/libguile/posix.c
@@ -1956,9 +1956,12 @@ SCM_DEFINE (scm_crypt, "crypt", 2, 0, 0,
   c_ret = crypt (c_key, c_salt);
 
   if (c_ret == NULL)
-    /* Note: Do not throw until we've released 'scm_i_misc_mutex' since
-       this would cause a deadlock down the path.  */
-    err = errno;
+    {
+      /* Note: Do not throw until we've released 'scm_i_misc_mutex'
+        since this would cause a deadlock down the path.  */
+      err = errno;
+      ret = SCM_BOOL_F;
+    }
   else
     {
       err = 0;
@@ -1967,7 +1970,7 @@ SCM_DEFINE (scm_crypt, "crypt", 2, 0, 0,
 
   scm_dynwind_end ();
 
-  if (err != 0)
+  if (scm_is_false (ret))
     {
       errno = err;
       SCM_SYSERROR;



reply via email to

[Prev in Thread] Current Thread [Next in Thread]