1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-20 11:40:18 +02:00

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.
This commit is contained in:
Ludovic Courtès 2018-01-10 16:19:09 +01:00 committed by Andy Wingo
parent c91e9e9220
commit 921364df27

View file

@ -1956,9 +1956,12 @@ SCM_DEFINE (scm_crypt, "crypt", 2, 0, 0,
c_ret = crypt (c_key, c_salt); c_ret = crypt (c_key, c_salt);
if (c_ret == NULL) 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. */ /* Note: Do not throw until we've released 'scm_i_misc_mutex'
err = errno; since this would cause a deadlock down the path. */
err = errno;
ret = SCM_BOOL_F;
}
else else
{ {
err = 0; err = 0;
@ -1967,7 +1970,7 @@ SCM_DEFINE (scm_crypt, "crypt", 2, 0, 0,
scm_dynwind_end (); scm_dynwind_end ();
if (err != 0) if (scm_is_false (ret))
{ {
errno = err; errno = err;
SCM_SYSERROR; SCM_SYSERROR;