From ee61edf59166d9292036af218c01dc73ebb97ed4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonin=20D=C3=A9cimo?= Date: Wed, 13 Apr 2022 12:19:50 +0200 Subject: [PATCH] Fix unix_closedir_job incorrectly checking return value of job LWT_UNIX_CHECK_JOB was incorrectly checking the directory stream instead of the return value of closedir. --- CHANGES | 1 + src/unix/unix_c/unix_closedir_job.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGES b/CHANGES index 554b25d627..d0ad7cc4d8 100644 --- a/CHANGES +++ b/CHANGES @@ -21,6 +21,7 @@ * Lwt.pick and Lwt.choose select preferentially failed promises as per documentation (#856, #874, Raman Varabets) * Use the WSA_FLAG_NO_HANDLE_INHERIT on Windows when creating sockets with WSASocket if the cloexec (non-inheritable) parameter is true. Fixes a Windows problem where a child process would inherit a supposedly non-inheritable socket. (#910, Antonin Décimo) + * Fix Lwt_unix.closedir incorrectly checking the return value of closedir(3). (#942, Antonin Décimo) ====== Deprecations ====== diff --git a/src/unix/unix_c/unix_closedir_job.c b/src/unix/unix_c/unix_closedir_job.c index 066cfd9f1e..d28b53031f 100644 --- a/src/unix/unix_c/unix_closedir_job.c +++ b/src/unix/unix_c/unix_closedir_job.c @@ -30,7 +30,7 @@ static void worker_closedir(struct job_closedir *job) static value result_closedir(struct job_closedir *job) { - LWT_UNIX_CHECK_JOB(job, job->dir < 0, "closedir"); + LWT_UNIX_CHECK_JOB(job, job->result < 0, "closedir"); lwt_unix_free_job(&job->job); return Val_unit; }