smol_http

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit ae17b4d7c573b4bde4bcfe5fab8ef27c0a5ed17f
parent fa5a482f5c8f7259993c9d0925cef72113bc98c9
Author: Anton Kling <anton@kling.gg>
Date:   Thu,  3 Mar 2022 17:44:16 +0100

Make sure to check the return value of the fstat call.

Diffstat:
Msmol_http.c | 4++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/smol_http.c b/smol_http.c @@ -273,10 +273,10 @@ write: PLEDGE("stdio", NULL); struct stat buf; - fstat(fd, &buf); + COND_PERROR_EXP(-1 == fstat(fd, &buf), "fstat", goto fd_end); COND_PERROR_EXP(-1 == sendfile(socket_desc, fd, 0, buf.st_size), "sendfile", /*NOP*/); - +fd_end: close(fd); cleanup: PLEDGE("", NULL);