summaryrefslogtreecommitdiffstats
path: root/sysif.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2022-12-30 19:08:37 -0800
committerKaz Kylheku <kaz@kylheku.com>2022-12-30 19:08:37 -0800
commite7f65d97c80d3604f8aedf67b057c7b79ea3b183 (patch)
tree153b92e2755fb13ffeb8358d2a935ad9215adf95 /sysif.c
parent39437afb997f53b33ac34a0c2ae07074ecda94e3 (diff)
downloadtxr-e7f65d97c80d3604f8aedf67b057c7b79ea3b183.tar.gz
txr-e7f65d97c80d3604f8aedf67b057c7b79ea3b183.tar.bz2
txr-e7f65d97c80d3604f8aedf67b057c7b79ea3b183.zip
crypt: fix for platforms that lack crypt_r.
* sysif.c (crypt_wrap): Don't call free(cd) on platforms where we don't have crypt_r and have not defined the cd variable. * test/018/crypt.tl: Move the (crypt "a" "b") test case to be GNU/Linux-only. On Solaris, it yields a valid-looking hash instead of failing. That hash will not validate the password though; i.e. (crypt "a" (crypt "a" "b")) is not equal to (crypt "a" "b").
Diffstat (limited to 'sysif.c')
-rw-r--r--sysif.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/sysif.c b/sysif.c
index 5af269d5..00354a10 100644
--- a/sysif.c
+++ b/sysif.c
@@ -2083,11 +2083,15 @@ static val crypt_wrap(val wkey, val wsalt)
if (hash != 0) {
val ret = string_utf8(hash);
+#if HAVE_CRYPT_R
free(cd);
+#endif
return ret;
}
+#if HAVE_CRYPT_R
free(cd);
+#endif
uw_ethrowf(error_s, lit("crypt failed: ~d/~s"), num(errno),
errno_to_str(errno), nao);