From 653df544a3bed96906f972657d64f48aa320ea08 Mon Sep 17 00:00:00 2001 From: hyung-hwan Date: Fri, 17 Jun 2022 07:57:03 +0000 Subject: [PATCH] fixed t06.c a bit --- hio/bin/t06.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/hio/bin/t06.c b/hio/bin/t06.c index 7662385..0e52495 100644 --- a/hio/bin/t06.c +++ b/hio/bin/t06.c @@ -91,7 +91,7 @@ static void on_htts_thr2_request (hio_t* hio, hio_dev_thr_iopair_t* iop, hio_svc fprintf (fp, "Status: 200\r\n"); fprintf (fp, "Content-Type: text/html\r\n\r\n"); - while (!feof(sf)) + while (!feof(sf) && !ferror(sf)) { size_t n; n = fread(buf, 1, sizeof(buf), sf); @@ -102,7 +102,8 @@ static void on_htts_thr2_request (hio_t* hio, hio_dev_thr_iopair_t* iop, hio_svc } /* invalid iop->wfd to mark that this function closed this file descriptor. - * no invalidation will lead to double closes on the same file descriptor. */ + * no invalidation will lead to double closes on the same file descriptor. + * the hio library attempt to close it if it's not INVALID after this handler. */ iop->wfd = HIO_SYSHND_INVALID; fclose (fp); }