diff options
author | Ludovic Courtès <ludo@gnu.org> | 2018-01-10 16:19:09 +0100 |
---|---|---|
committer | Andy Wingo <wingo@pobox.com> | 2018-08-07 11:36:10 +0200 |
commit | 921364df27423a2979dcd40481bcb65736148368 (patch) | |
tree | b17ab264381e861d4b270423ad7e274e950dbc5f /libguile/posix.c | |
parent | c91e9e9220aca3d1d3245a742fcadf3e0d8f472c (diff) | |
download | guile-921364df27423a2979dcd40481bcb65736148368.tar.gz |
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.
Diffstat (limited to 'libguile/posix.c')
-rw-r--r-- | libguile/posix.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/libguile/posix.c b/libguile/posix.c index b35dfbd80..2e3fed67a 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; |